From bd45d503e5d007e730f4e81dccd7e7864c9a85cc Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 6 Aug 2020 14:58:01 +0200 Subject: Reorganize shared models --- shared/models/users/user-role.ts | 36 ------------------------------------ 1 file changed, 36 deletions(-) (limited to 'shared/models/users/user-role.ts') diff --git a/shared/models/users/user-role.ts b/shared/models/users/user-role.ts index 772988c0c..94413abca 100644 --- a/shared/models/users/user-role.ts +++ b/shared/models/users/user-role.ts @@ -1,42 +1,6 @@ -import { UserRight } from './user-right.enum' - // Keep the order export enum UserRole { ADMINISTRATOR = 0, MODERATOR = 1, USER = 2 } - -export const USER_ROLE_LABELS: { [ id in UserRole ]: string } = { - [UserRole.USER]: 'User', - [UserRole.MODERATOR]: 'Moderator', - [UserRole.ADMINISTRATOR]: 'Administrator' -} - -const userRoleRights: { [ id in UserRole ]: UserRight[] } = { - [UserRole.ADMINISTRATOR]: [ - UserRight.ALL - ], - - [UserRole.MODERATOR]: [ - UserRight.MANAGE_VIDEO_BLACKLIST, - UserRight.MANAGE_ABUSES, - UserRight.REMOVE_ANY_VIDEO, - UserRight.REMOVE_ANY_VIDEO_CHANNEL, - UserRight.REMOVE_ANY_VIDEO_PLAYLIST, - UserRight.REMOVE_ANY_VIDEO_COMMENT, - UserRight.UPDATE_ANY_VIDEO, - UserRight.SEE_ALL_VIDEOS, - UserRight.MANAGE_ACCOUNTS_BLOCKLIST, - UserRight.MANAGE_SERVERS_BLOCKLIST, - UserRight.MANAGE_USERS - ], - - [UserRole.USER]: [] -} - -export function hasUserRight (userRole: UserRole, userRight: UserRight) { - const userRights = userRoleRights[userRole] - - return userRights.includes(UserRight.ALL) || userRights.includes(userRight) -} -- cgit v1.2.3