aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/models/users
diff options
context:
space:
mode:
Diffstat (limited to 'shared/models/users')
-rw-r--r--shared/models/users/user-right.enum.ts4
-rw-r--r--shared/models/users/user-role.ts8
-rw-r--r--shared/models/users/user.model.ts10
3 files changed, 15 insertions, 7 deletions
diff --git a/shared/models/users/user-right.enum.ts b/shared/models/users/user-right.enum.ts
index 4a28a229d..2f88a65de 100644
--- a/shared/models/users/user-right.enum.ts
+++ b/shared/models/users/user-right.enum.ts
@@ -33,5 +33,7 @@ export enum UserRight {
33 SEE_ALL_VIDEOS, 33 SEE_ALL_VIDEOS,
34 CHANGE_VIDEO_OWNERSHIP, 34 CHANGE_VIDEO_OWNERSHIP,
35 35
36 MANAGE_PLUGINS 36 MANAGE_PLUGINS,
37
38 MANAGE_VIDEOS_REDUNDANCIES
37} 39}
diff --git a/shared/models/users/user-role.ts b/shared/models/users/user-role.ts
index 0b6554e51..2b08b5850 100644
--- a/shared/models/users/user-role.ts
+++ b/shared/models/users/user-role.ts
@@ -7,15 +7,13 @@ export enum UserRole {
7 USER = 2 7 USER = 2
8} 8}
9 9
10// TODO: use UserRole for key once https://github.com/Microsoft/TypeScript/issues/13042 is fixed 10export const USER_ROLE_LABELS: { [ id in UserRole ]: string } = {
11export const USER_ROLE_LABELS: { [ id: number ]: string } = {
12 [UserRole.USER]: 'User', 11 [UserRole.USER]: 'User',
13 [UserRole.MODERATOR]: 'Moderator', 12 [UserRole.MODERATOR]: 'Moderator',
14 [UserRole.ADMINISTRATOR]: 'Administrator' 13 [UserRole.ADMINISTRATOR]: 'Administrator'
15} 14}
16 15
17// TODO: use UserRole for key once https://github.com/Microsoft/TypeScript/issues/13042 is fixed 16const userRoleRights: { [ id in UserRole ]: UserRight[] } = {
18const userRoleRights: { [ id: number ]: UserRight[] } = {
19 [UserRole.ADMINISTRATOR]: [ 17 [UserRole.ADMINISTRATOR]: [
20 UserRight.ALL 18 UserRight.ALL
21 ], 19 ],
@@ -40,5 +38,5 @@ const userRoleRights: { [ id: number ]: UserRight[] } = {
40export function hasUserRight (userRole: UserRole, userRight: UserRight) { 38export function hasUserRight (userRole: UserRole, userRight: UserRight) {
41 const userRights = userRoleRights[userRole] 39 const userRights = userRoleRights[userRole]
42 40
43 return userRights.indexOf(UserRight.ALL) !== -1 || userRights.indexOf(userRight) !== -1 41 return userRights.includes(UserRight.ALL) || userRights.includes(userRight)
44} 42}
diff --git a/shared/models/users/user.model.ts b/shared/models/users/user.model.ts
index 168851196..6c959ceea 100644
--- a/shared/models/users/user.model.ts
+++ b/shared/models/users/user.model.ts
@@ -1,6 +1,5 @@
1import { Account } from '../actors' 1import { Account } from '../actors'
2import { VideoChannel } from '../videos/channel/video-channel.model' 2import { VideoChannel } from '../videos/channel/video-channel.model'
3import { VideoPlaylist } from '../videos/playlist/video-playlist.model'
4import { UserRole } from './user-role' 3import { UserRole } from './user-role'
5import { NSFWPolicyType } from '../videos/nsfw-policy.type' 4import { NSFWPolicyType } from '../videos/nsfw-policy.type'
6import { UserNotificationSetting } from './user-notification-setting.model' 5import { UserNotificationSetting } from './user-notification-setting.model'
@@ -32,6 +31,11 @@ export interface User {
32 videoQuotaDaily: number 31 videoQuotaDaily: number
33 videoQuotaUsed?: number 32 videoQuotaUsed?: number
34 videoQuotaUsedDaily?: number 33 videoQuotaUsedDaily?: number
34 videosCount?: number
35 videoAbusesCount?: number
36 videoAbusesAcceptedCount?: number
37 videoAbusesCreatedCount?: number
38 videoCommentsCount? : number
35 39
36 theme: string 40 theme: string
37 41
@@ -46,6 +50,10 @@ export interface User {
46 noWelcomeModal: boolean 50 noWelcomeModal: boolean
47 51
48 createdAt: Date 52 createdAt: Date
53
54 pluginAuth: string | null
55
56 lastLoginDate: Date | null
49} 57}
50 58
51export interface MyUserSpecialPlaylist { 59export interface MyUserSpecialPlaylist {