Fix: Permission PUT route priority.

This commit is contained in:
Paul
2021-07-01 17:49:48 +01:00
parent 57f81e018c
commit e452d6a362
5 changed files with 21 additions and 11 deletions

View File

@@ -13,7 +13,7 @@ pub struct Data {
permissions: u32
}
#[put("/<target>/permissions/<role>", data = "<data>")]
#[put("/<target>/permissions/<role>", data = "<data>", rank = 2)]
pub async fn req(user: User, target: Ref, role: String, data: Json<Data>) -> Result<()> {
let target = target.fetch_channel().await?;
@@ -33,7 +33,7 @@ pub async fn req(user: User, target: Ref, role: String, data: Json<Data>) -> Res
if !target.roles.has_element(&role) {
return Err(Error::NotFound);
}
let permissions: u32 = ChannelPermission::View as u32 | data.permissions;
get_collection("channels")