desmos_bindings/subspaces/
types.rs1pub use crate::proto::desmos::subspaces::v3::*;
4
5use crate::cosmos_types::Any;
6
7pub enum Permission {
9 EditSubspace,
11
12 DeleteSubspace,
14
15 ManageSections,
17
18 ManageGroups,
20
21 SetPermissions,
24
25 Everything,
28
29 Write,
31
32 InteractWithContent,
34
35 EditOwnContent,
37
38 ModerateContent,
40}
41
42impl Into<String> for Permission {
43 fn into(self) -> String {
44 match self {
45 Permission::EditSubspace => "EDIT_SUBSPACE".into(),
46
47 Permission::DeleteSubspace => "DELETE_SUBSPACE".into(),
48
49 Permission::ManageSections => "MANAGE_SECTIONS".into(),
50
51 Permission::ManageGroups => "MANAGE_GROUPS".into(),
52
53 Permission::SetPermissions => "SET_PERMISSIONS".into(),
54
55 Permission::Everything => "EVERYTHING".into(),
56
57 Permission::Write => "WRITE_CONTENT".into(),
58
59 Permission::InteractWithContent => "INTERACT_WITH_CONTENT".into(),
60
61 Permission::EditOwnContent => "EDIT_OWN_CONTENT".into(),
62
63 Permission::ModerateContent => "MODERATE_CONTENT".into(),
64 }
65 }
66}
67
68#[derive(Clone)]
70pub enum Grantee {
71 UserGrantee(UserGrantee),
73
74 GroupGrantee(GroupGrantee),
76}
77
78impl Grantee {
79 pub fn user_grantee(user: impl Into<String>) -> Self {
81 Self::UserGrantee(UserGrantee { user: user.into() })
82 }
83
84 pub fn group_grantee(group_id: u32) -> Self {
86 Self::GroupGrantee(GroupGrantee { group_id })
87 }
88}
89
90impl Into<Any> for Grantee {
91 fn into(self) -> Any {
92 match self {
93 Grantee::UserGrantee(grantee) => grantee.into(),
94 Grantee::GroupGrantee(grantee) => grantee.into(),
95 }
96 }
97}