Guard admin assignment/removal against empty filter
This commit is contained in:
@@ -60,22 +60,25 @@ pub(super) async fn ldap_login(
|
|||||||
.await?;
|
.await?;
|
||||||
}
|
}
|
||||||
|
|
||||||
let is_tuwunel_admin = services
|
// only perform admin add/remove check if admin_filter is set
|
||||||
.admin
|
if !services.config.ldap.admin_filter.is_empty() {
|
||||||
.user_is_admin(lowercased_user_id)
|
let is_tuwunel_admin = services
|
||||||
.await;
|
.admin
|
||||||
|
.user_is_admin(lowercased_user_id)
|
||||||
|
.await;
|
||||||
|
|
||||||
if is_ldap_admin && !is_tuwunel_admin {
|
if is_ldap_admin && !is_tuwunel_admin {
|
||||||
services
|
services
|
||||||
.admin
|
.admin
|
||||||
.make_user_admin(lowercased_user_id)
|
.make_user_admin(lowercased_user_id)
|
||||||
.boxed()
|
.boxed()
|
||||||
.await?;
|
.await?;
|
||||||
} else if !is_ldap_admin && is_tuwunel_admin {
|
} else if !is_ldap_admin && is_tuwunel_admin {
|
||||||
services
|
services
|
||||||
.admin
|
.admin
|
||||||
.revoke_admin(lowercased_user_id)
|
.revoke_admin(lowercased_user_id)
|
||||||
.await?;
|
.await?;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(user_id)
|
Ok(user_id)
|
||||||
|
|||||||
Reference in New Issue
Block a user