Import source: src/lib/permissions
Import the existing local project snapshot. This commit organizes existing files; it does not represent newly developed functionality.
This commit is contained in:
@@ -0,0 +1,51 @@
|
|||||||
|
export type Permission =
|
||||||
|
| "dashboard:read"
|
||||||
|
| "tools:read"
|
||||||
|
| "websites:manage"
|
||||||
|
| "domains:manage"
|
||||||
|
| "files:manage"
|
||||||
|
| "databases:manage"
|
||||||
|
| "email:manage"
|
||||||
|
| "metrics:read"
|
||||||
|
| "security:manage"
|
||||||
|
| "software:manage"
|
||||||
|
| "advanced:manage"
|
||||||
|
| "servers:manage"
|
||||||
|
| "users:manage"
|
||||||
|
| "resellers:manage"
|
||||||
|
| "backups:manage"
|
||||||
|
| "automation:manage"
|
||||||
|
| "notifications:read"
|
||||||
|
| "audit:read"
|
||||||
|
| "support:manage"
|
||||||
|
| "settings:manage";
|
||||||
|
|
||||||
|
export const rolePermissions: Record<string, Permission[]> = {
|
||||||
|
"Super administrator": [
|
||||||
|
"dashboard:read",
|
||||||
|
"tools:read",
|
||||||
|
"websites:manage",
|
||||||
|
"domains:manage",
|
||||||
|
"files:manage",
|
||||||
|
"databases:manage",
|
||||||
|
"email:manage",
|
||||||
|
"metrics:read",
|
||||||
|
"security:manage",
|
||||||
|
"software:manage",
|
||||||
|
"advanced:manage",
|
||||||
|
"servers:manage",
|
||||||
|
"users:manage",
|
||||||
|
"resellers:manage",
|
||||||
|
"backups:manage",
|
||||||
|
"automation:manage",
|
||||||
|
"notifications:read",
|
||||||
|
"audit:read",
|
||||||
|
"support:manage",
|
||||||
|
"settings:manage",
|
||||||
|
],
|
||||||
|
"Read-only auditor": ["dashboard:read", "tools:read", "metrics:read", "audit:read"],
|
||||||
|
};
|
||||||
|
|
||||||
|
export function can(permissions: Permission[], permission: Permission) {
|
||||||
|
return permissions.includes(permission);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user