87 lines
2.6 KiB
TypeScript
87 lines
2.6 KiB
TypeScript
/**
|
|
* RBAC service — custom roles CRUD and permission assignment.
|
|
*/
|
|
export type RoleDto = {
|
|
id: number;
|
|
name: string;
|
|
description: string | null;
|
|
isSystem: boolean;
|
|
permissionKeys: string[];
|
|
userCount: number;
|
|
};
|
|
export type PermissionDto = {
|
|
key: string;
|
|
description: string | null;
|
|
category: string | null;
|
|
resource: string | null;
|
|
action: string | null;
|
|
};
|
|
export declare function listPermissions(): Promise<{
|
|
categories: Record<string, PermissionDto[]>;
|
|
}>;
|
|
export declare function listRoles(): Promise<RoleDto[]>;
|
|
export declare function getRole(roleId: number): Promise<(RoleDto & {
|
|
assignedUsers: Array<{
|
|
id: string;
|
|
email: string | null;
|
|
fullName: string | null;
|
|
}>;
|
|
}) | null>;
|
|
export declare function createRole(input: {
|
|
name: string;
|
|
description?: string;
|
|
permissionKeys: string[];
|
|
}, actorUserId: string): Promise<RoleDto>;
|
|
export declare function updateRole(roleId: number, input: {
|
|
name?: string;
|
|
description?: string;
|
|
permissionKeys?: string[];
|
|
}, actorUserId: string): Promise<RoleDto>;
|
|
export declare function deleteRole(roleId: number, actorUserId: string): Promise<void>;
|
|
export declare function bumpUserTokenOnRoleChange(userId: string): Promise<void>;
|
|
export type AdminStaffUserDto = {
|
|
id: string;
|
|
email: string | null;
|
|
fullName: string | null;
|
|
isEnabled: boolean;
|
|
roles: string[];
|
|
inheritedCount: number;
|
|
allowCount: number;
|
|
denyCount: number;
|
|
effectiveCount: number;
|
|
};
|
|
export declare function listAdminUsers(filters: {
|
|
search?: string;
|
|
role?: string;
|
|
exception?: 'all' | 'any' | 'allow' | 'deny' | 'none';
|
|
permission?: string;
|
|
limit?: number;
|
|
offset?: number;
|
|
}): Promise<{
|
|
users: AdminStaffUserDto[];
|
|
total: number;
|
|
}>;
|
|
export type UserPermissionItemDto = {
|
|
key: string;
|
|
description: string | null;
|
|
category: string | null;
|
|
inherited: boolean;
|
|
directAllow: boolean;
|
|
directDeny: boolean;
|
|
effective: boolean;
|
|
sources: string[];
|
|
};
|
|
export declare function getAdminUser(userId: string): Promise<{
|
|
user: AdminStaffUserDto;
|
|
permissions: UserPermissionItemDto[];
|
|
categories: Record<string, UserPermissionItemDto[]>;
|
|
} | null>;
|
|
export declare function applyUserPermissionChanges(userId: string, changes: Array<{
|
|
key: string;
|
|
action: 'allow' | 'deny' | 'reset';
|
|
}>, actorUserId: string): Promise<{
|
|
user: AdminStaffUserDto;
|
|
permissions: UserPermissionItemDto[];
|
|
categories: Record<string, UserPermissionItemDto[]>;
|
|
}>;
|
|
//# sourceMappingURL=rbacService.d.ts.map
|