bugfix: create organization button is now hidden for none owner users.

This commit is contained in:
2026-05-18 13:37:20 +03:30
parent 535b49310f
commit 95ed1bd4ab
4 changed files with 74 additions and 17 deletions

View File

@@ -16,6 +16,11 @@ export function hasPermission(org: Organization | null, permission: string): boo
return Boolean(org.permissions?.includes(permission));
}
/** True when the user is owner of the currently selected organization. */
export function canCreateOrganizationFromCurrentOrg(org: Organization | null): boolean {
return Boolean(org?.isOwner);
}
/** Sidebar / route guard: READ access to a tab */
export function canViewTab(org: Organization | null, readPermission: string): boolean {
return hasPermission(org, readPermission);