1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
use serde_repr::{Deserialize_repr, Serialize_repr};
use crate::{impl_default, impl_display};
/// A deprecated representation of a superset of the users who have permission to create web-public channels in the organization, available for backwards-compatibility.
///
/// Clients should use `can_create_web_public_channel_group` instead.
///
/// It is an enum with the following possible values, corresponding to roles/system groups:
///
/// - 2: Admins only
/// - 4: Admins and moderators only
/// - 6: Nobody
/// - 7: Owners only
///
/// **Changes**: Deprecated in Zulip 10.0 (feature level 280) and replaced by `realm_can_create_web_public_channel_group`,
/// which supports finer resolution of configurations, resulting in this property being inaccurate following that transition.
///
/// **Changes**: Added in Zulip 5.0 (feature level 103).
///
/// [permission-level](https://zulip.com/api/roles-and-permissions#permission-levels)
#[repr(u8)]
#[derive(Clone, Copy, Debug, Eq, PartialEq, Deserialize_repr, Serialize_repr)]
pub enum RealmCreateWebPublicStreamPolicy {
/// Admins only
AdminsOnly = 2,
/// Admins and moderators only
Admins = 4,
/// Nobody
Nobody = 6,
/// Owners only
OwnersOnly = 7,
}
impl RealmCreateWebPublicStreamPolicy {
/// Represents the string value of the admins only policy.
pub const ADMINS_ONLY: &str = "admins_only";
/// Represents the string value of the admins or moderators policy.
pub const ADMINS: &str = "admins";
/// Represents the string value of the nobody policy.
pub const NOBODY: &str = "nobody";
/// Represents the string value of the owners only policy.
pub const OWNERS_ONLY: &str = "owners_only";
/// Creates a new [Self].
pub const fn new() -> Self {
Self::AdminsOnly
}
/// Gets the string representation of the [Self].
pub const fn as_str(&self) -> &'static str {
match self {
Self::AdminsOnly => Self::ADMINS_ONLY,
Self::Admins => Self::ADMINS,
Self::Nobody => Self::NOBODY,
Self::OwnersOnly => Self::OWNERS_ONLY,
}
}
}
impl_default!(RealmCreateWebPublicStreamPolicy);
impl_display!(RealmCreateWebPublicStreamPolicy: str);