You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
docker-infisical/frontend/src/hooks/api/roles/types.ts

82 lines
1.8 KiB

export type TGetRolesDTO = {
orgId: string;
workspaceId?: string;
};
export type TRole<T extends string | undefined> = {
_id: string;
organization: string;
workspace: T;
name: string;
description: string;
slug: string;
permissions: T extends string ? TProjectPermission[] : TPermission[];
createdAt: string;
updatedAt: string;
};
export type TPermission = TWorkspacePermission | TGeneralPermission;
type TGeneralPermission = {
condition?: Record<string, any>;
action: "read" | "edit" | "create" | "delete";
subject: "member" | "role" | "incident-contact" | "sso" | "billing" | "settings";
};
type TWorkspacePermission = {
condition?: Record<string, any>;
action: "read" | "create";
subject: "workspace";
};
export type TProjectPermission = TProjectGeneralPermission | TProjectWorkspacePermission;
type TProjectGeneralPermission = {
condition?: Record<string, any>;
action: "read" | "edit" | "create" | "delete";
subject:
| "member"
| "role"
| "settings"
| "secrets"
| "environments"
| "folders"
| "secret-imports"
| "service-tokens";
};
type TProjectWorkspacePermission = {
condition?: Record<string, any>;
action: "delete" | "edit";
subject: "workspace";
};
export type TCreateRoleDTO<T extends string | undefined> = {
orgId: string;
workspaceId?: T;
name: string;
description?: string;
slug: string;
permissions: T extends string ? TProjectPermission[] : TPermission[];
};
export type TUpdateRoleDTO<T extends string | undefined> = {
orgId: string;
id: string;
workspaceId?: T;
} & Partial<Omit<TCreateRoleDTO<T>, "orgId" | "workspaceId">>;
export type TDeleteRoleDTO = {
orgId: string;
id: string;
workspaceId?: string;
};
export type TGetUserOrgPermissionsDTO = {
orgId: string;
};
export type TGetUserProjectPermissionDTO = {
workspaceId: string;
};