zulip_api/message/channel_permission/can_remove_subscribers_group.rs
1use serde::{Deserialize, Serialize};
2
3use crate::{impl_cow, GroupSetting};
4
5/// Represents A group-setting value defining the set of users who have permission to remove subscribers from this channel.
6///
7/// Organization administrators can unsubscribe others from a channel as though they were in this group without being explicitly listed here. Note that a user must have metadata access to a channel and permission to administer the channel in order to modify this setting.
8///
9/// **Changes**: Prior to Zulip 10.0 (feature level 349), channel administrators could not unsubscribe other users if they were not an organization administrator or part of `can_remove_subscribers_group`. Realm administrators were not allowed to unsubscribe other users from a private channel if they were not subscribed to that channel. Prior to Zulip 10.0 (feature level 320), this value was always the integer ID of a system group. Before Zulip 8.0 (feature level 197), the `can_remove_subscribers_group` setting was named `can_remove_subscribers_group_id`. New in Zulip 6.0 (feature level 142). [setting-values]: /api/group-setting-values
10///
11/// Modified from `openapi-generator-cli` output:
12///
13/// ```shell,no_build,no_run
14/// $ openapi-generator-cli generate -g rust -i ./zerver/openapi/zulip.yaml -o zulip-openapi --skip-validate-spec
15/// ```
16///
17/// ```text
18/// /*
19/// * Zulip REST API
20/// *
21/// * Powerful open source group chat
22/// *
23/// * The version of the OpenAPI document: 1.0.0
24/// *
25/// * Generated by: https://openapi-generator.tech
26/// */
27/// ```
28///
29/// See [zerver/openapi/zulip.yaml](https://github.com/zulip/zulip/blob/main/zerver/openapi/zulip.yaml) for the original OpenAPI configuration.
30///
31/// Configuration slightly modified to work with the Rust generator of [`openapi-generator-cli`](https://openapi-generator.tech).
32#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
33pub struct CanRemoveSubscribersGroup(pub GroupSetting);
34
35impl CanRemoveSubscribersGroup {
36 /// Creates a new [Self].
37 pub const fn new() -> Self {
38 Self(GroupSetting::new())
39 }
40
41 /// Converts the inner representation into a [Self].
42 pub const fn from_inner(val: GroupSetting) -> Self {
43 Self(val)
44 }
45
46 /// Converts the [Self] into the inner representation.
47 pub fn into_inner(self) -> GroupSetting {
48 self.0
49 }
50}
51
52impl Default for CanRemoveSubscribersGroup {
53 fn default() -> Self {
54 Self::new()
55 }
56}
57
58impl_cow!(CanRemoveSubscribersGroup);