Files
windmill/frontend/src/lib/cloud.ts
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

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
}