block adding/inviting members to admins workspace (#8721)
* fix: block adding/inviting members to admins workspace on CE The admins workspace is reserved for superadmins only. On CE (non-enterprise), prevent adding or inviting users to it via both API and UI. Backend: add #[cfg(not(feature = "enterprise"))] guards to invite_user and add_user endpoints that reject requests targeting the admins workspace. Frontend: show an info alert on the admins workspace members page and hide the add/invite/auto-add buttons. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: use derived variable for admins workspace alert consistency Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -4044,6 +4044,13 @@ async fn invite_user(
|
||||
) -> Result<(StatusCode, String)> {
|
||||
require_admin(is_admin, &username)?;
|
||||
|
||||
#[cfg(not(feature = "enterprise"))]
|
||||
if w_id == "admins" {
|
||||
return Err(Error::BadRequest(
|
||||
"The admins workspace is reserved for superadmins. Members cannot be added to it without an enterprise license.".to_string(),
|
||||
));
|
||||
}
|
||||
|
||||
nu.email = nu.email.to_lowercase();
|
||||
|
||||
let mut tx = db.begin().await?;
|
||||
@@ -4109,6 +4116,14 @@ async fn add_user(
|
||||
Json(mut nu): Json<NewWorkspaceUser>,
|
||||
) -> Result<(StatusCode, String)> {
|
||||
require_admin(authed.is_admin, &authed.username)?;
|
||||
|
||||
#[cfg(not(feature = "enterprise"))]
|
||||
if w_id == "admins" {
|
||||
return Err(Error::BadRequest(
|
||||
"The admins workspace is reserved for superadmins. Members cannot be added to it without an enterprise license.".to_string(),
|
||||
));
|
||||
}
|
||||
|
||||
nu.email = nu.email.to_lowercase();
|
||||
|
||||
let mut tx = db.begin().await?;
|
||||
|
||||
Reference in New Issue
Block a user