mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-20 16:02:19 +00:00
564b93b968
* 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>
20 lines
750 B
TypeScript
20 lines
750 B
TypeScript
import { BROWSER } from 'esm-env'
|
|
|
|
export function isCloudHosted(): boolean {
|
|
return BROWSER && window.location.hostname == 'app.windmill.dev'
|
|
}
|
|
|
|
// On the managed cloud, the public demo workspace is kept clean and consistent by
|
|
// disabling folder creation, item sharing, and group creation for non-admins. The
|
|
// backend enforces the same rule; this only drives the UI hints.
|
|
export const DEMO_RESTRICTION_HINT =
|
|
'Disabled in the demo workspace. Create your own workspace to keep the demo clean and consistent.'
|
|
|
|
export function isDemoWorkspaceRestricted(
|
|
workspace: string | undefined,
|
|
isAdmin: boolean | undefined,
|
|
isSuperAdmin: boolean | undefined
|
|
): boolean {
|
|
return isCloudHosted() && workspace === 'demo' && !isAdmin && !isSuperAdmin
|
|
}
|