Add check_is_channel_participant

Refactor permission checks to load ancestor permissions into memory
for all checks to make the different logics more explicit.
This commit is contained in:
Conrad Irwin
2023-10-12 19:59:50 -06:00
parent 78432d08ca
commit a7db2aa39d
7 changed files with 292 additions and 38 deletions
+4
View File
@@ -91,6 +91,8 @@ pub enum ChannelRole {
Member,
#[sea_orm(string_value = "guest")]
Guest,
#[sea_orm(string_value = "banned")]
Banned,
}
impl From<proto::ChannelRole> for ChannelRole {
@@ -99,6 +101,7 @@ impl From<proto::ChannelRole> for ChannelRole {
proto::ChannelRole::Admin => ChannelRole::Admin,
proto::ChannelRole::Member => ChannelRole::Member,
proto::ChannelRole::Guest => ChannelRole::Guest,
proto::ChannelRole::Banned => ChannelRole::Banned,
}
}
}
@@ -109,6 +112,7 @@ impl Into<proto::ChannelRole> for ChannelRole {
ChannelRole::Admin => proto::ChannelRole::Admin,
ChannelRole::Member => proto::ChannelRole::Member,
ChannelRole::Guest => proto::ChannelRole::Guest,
ChannelRole::Banned => proto::ChannelRole::Banned,
}
}
}