mirror of
https://github.com/CaramelFur/Picsur.git
synced 2026-05-07 12:36:56 +02:00
add better role indications
This commit is contained in:
@@ -9,6 +9,8 @@ const PermanentRolesTuple = tuple('guest', 'user');
|
||||
const ImmuteableRolesTuple = tuple('admin');
|
||||
// These roles can never be removed from the server
|
||||
const SystemRolesTuple = tuple(...PermanentRolesTuple, ...ImmuteableRolesTuple);
|
||||
// These roles will be applied by default to new users
|
||||
export const DefaultRolesList: string[] = ['user'];
|
||||
|
||||
// Derivatives
|
||||
|
||||
@@ -16,6 +18,7 @@ export const PermanentRolesList: string[] = PermanentRolesTuple;
|
||||
export const ImmuteableRolesList: string[] = ImmuteableRolesTuple;
|
||||
export const SystemRolesList: string[] = SystemRolesTuple;
|
||||
|
||||
|
||||
export type SystemRole = typeof SystemRolesTuple[number];
|
||||
export type SystemRoles = SystemRole[];
|
||||
|
||||
|
||||
8
shared/src/dto/specialusers.dto.ts
Normal file
8
shared/src/dto/specialusers.dto.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
// Cannot be deleted
|
||||
export const SystemUsersList = ['guest', 'admin'];
|
||||
|
||||
// Cannot have different permissions
|
||||
export const LockedPermsUsersList = ['admin'];
|
||||
|
||||
// Cannot login
|
||||
export const LockedLoginUsersList = ['guest'];
|
||||
@@ -1,8 +1,5 @@
|
||||
import { Exclude } from 'class-transformer';
|
||||
import {
|
||||
IsArray, IsOptional,
|
||||
IsString
|
||||
} from 'class-validator';
|
||||
import { IsArray, IsOptional, IsString } from 'class-validator';
|
||||
import { Roles } from '../dto/roles.dto';
|
||||
import { EntityID } from '../validators/entity-id.validator';
|
||||
import { IsPlainTextPwd, IsUsername } from '../validators/user.validators';
|
||||
|
||||
Reference in New Issue
Block a user