1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-25 00:07:47 +01:00
unleash.unleash/frontend/src/interfaces/permissions.ts
Nuno Góis 023db4e2c9
refactor: favor permission name over id (#5409)
https://linear.app/unleash/issue/2-1664/create-db-migration-that-favors-the-name-column-over-id-for

Similar to https://github.com/Unleash/unleash/pull/5398, but
non-breaking (semver).
This keeps the permissions `id` column intact, however favors the
permission name whenever possible.
2023-11-27 11:12:09 +00:00

39 lines
838 B
TypeScript

import {
ROOT_PERMISSION_TYPE,
PROJECT_PERMISSION_TYPE,
ENVIRONMENT_PERMISSION_TYPE,
} from '@server/util/constants';
export type PermissionType =
| typeof ROOT_PERMISSION_TYPE
| typeof PROJECT_PERMISSION_TYPE
| typeof ENVIRONMENT_PERMISSION_TYPE;
export interface IPermission {
name: string;
displayName: string;
type: PermissionType;
environment?: string;
}
export interface IPermissions {
root: IPermission[];
project: IPermission[];
environments: IProjectEnvironmentPermissions[];
}
export interface IProjectEnvironmentPermissions {
name: string;
permissions: IPermission[];
}
export interface ICheckedPermissions {
[key: string]: IPermission;
}
export interface IPermissionCategory {
label: string;
type: PermissionType;
permissions: IPermission[];
}