Files
windmill/backend/windmill-api-groups/src/lib.rs
T
Ruben Fiszel 564b93b968 (cloud) restrict folder creation, sharing and group creation in demo workspace (#10257)
* feat: restrict folder creation, sharing and group creation in demo workspace

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix: guard update_folder sharing bypass and gate folder editor/share ACL controls in demo

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix: guard remove_owner grant path and gate alternate folder-create controls; keep pure-revoke controls enabled

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-22 13:00:01 +02:00

25 lines
890 B
Rust

pub mod folder_history;
pub mod folders;
pub mod granular_acls;
pub mod groups;
use windmill_api_auth::ApiAuthed;
use windmill_common::{error::Error, worker::CLOUD_HOSTED};
/// The public demo workspace on the managed cloud is kept clean and consistent by
/// restricting folder creation, item sharing, and group creation for non-admins.
/// `action` is a short noun phrase completing "… is disabled …" (e.g.
/// "Folder creation", "Sharing"). Returns `Err(BadRequest)` when the caller is blocked.
pub fn check_demo_workspace_restriction(
authed: &ApiAuthed,
w_id: &str,
action: &str,
) -> Result<(), Error> {
if *CLOUD_HOSTED && w_id == "demo" && !authed.is_admin {
return Err(Error::BadRequest(format!(
"{action} is disabled in the demo workspace. Create your own workspace to keep the demo clean and consistent."
)));
}
Ok(())
}