diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-10-27 16:55:03 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-10-27 16:55:03 +0200 |
commit | 954605a804da399317ca62afa2fb9244afa11ebf (patch) | |
tree | de6ee69280bfb928bc01c29430e13d5b820e921a /server/models/user/user-interface.ts | |
parent | e02573ad67626210ed279bad321ee139094921a1 (diff) | |
download | PeerTube-954605a804da399317ca62afa2fb9244afa11ebf.tar.gz PeerTube-954605a804da399317ca62afa2fb9244afa11ebf.tar.zst PeerTube-954605a804da399317ca62afa2fb9244afa11ebf.zip |
Support roles with rights and add moderator role
Diffstat (limited to 'server/models/user/user-interface.ts')
-rw-r--r-- | server/models/user/user-interface.ts | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/server/models/user/user-interface.ts b/server/models/user/user-interface.ts index 1b5233eaf..49c75aa3b 100644 --- a/server/models/user/user-interface.ts +++ b/server/models/user/user-interface.ts | |||
@@ -3,15 +3,16 @@ import * as Promise from 'bluebird' | |||
3 | 3 | ||
4 | // Don't use barrel, import just what we need | 4 | // Don't use barrel, import just what we need |
5 | import { User as FormattedUser } from '../../../shared/models/users/user.model' | 5 | import { User as FormattedUser } from '../../../shared/models/users/user.model' |
6 | import { UserRole } from '../../../shared/models/users/user-role.type' | ||
7 | import { ResultList } from '../../../shared/models/result-list.model' | 6 | import { ResultList } from '../../../shared/models/result-list.model' |
8 | import { AuthorInstance } from '../video/author-interface' | 7 | import { AuthorInstance } from '../video/author-interface' |
8 | import { UserRight } from '../../../shared/models/users/user-right.enum' | ||
9 | import { UserRole } from '../../../shared/models/users/user-role' | ||
9 | 10 | ||
10 | export namespace UserMethods { | 11 | export namespace UserMethods { |
12 | export type HasRight = (this: UserInstance, right: UserRight) => boolean | ||
11 | export type IsPasswordMatch = (this: UserInstance, password: string) => Promise<boolean> | 13 | export type IsPasswordMatch = (this: UserInstance, password: string) => Promise<boolean> |
12 | 14 | ||
13 | export type ToFormattedJSON = (this: UserInstance) => FormattedUser | 15 | export type ToFormattedJSON = (this: UserInstance) => FormattedUser |
14 | export type IsAdmin = (this: UserInstance) => boolean | ||
15 | export type IsAbleToUploadVideo = (this: UserInstance, videoFile: Express.Multer.File) => Promise<boolean> | 16 | export type IsAbleToUploadVideo = (this: UserInstance, videoFile: Express.Multer.File) => Promise<boolean> |
16 | 17 | ||
17 | export type CountTotal = () => Promise<number> | 18 | export type CountTotal = () => Promise<number> |
@@ -31,7 +32,7 @@ export namespace UserMethods { | |||
31 | export interface UserClass { | 32 | export interface UserClass { |
32 | isPasswordMatch: UserMethods.IsPasswordMatch, | 33 | isPasswordMatch: UserMethods.IsPasswordMatch, |
33 | toFormattedJSON: UserMethods.ToFormattedJSON, | 34 | toFormattedJSON: UserMethods.ToFormattedJSON, |
34 | isAdmin: UserMethods.IsAdmin, | 35 | hasRight: UserMethods.HasRight, |
35 | isAbleToUploadVideo: UserMethods.IsAbleToUploadVideo, | 36 | isAbleToUploadVideo: UserMethods.IsAbleToUploadVideo, |
36 | 37 | ||
37 | countTotal: UserMethods.CountTotal, | 38 | countTotal: UserMethods.CountTotal, |
@@ -62,7 +63,7 @@ export interface UserInstance extends UserClass, UserAttributes, Sequelize.Insta | |||
62 | 63 | ||
63 | isPasswordMatch: UserMethods.IsPasswordMatch | 64 | isPasswordMatch: UserMethods.IsPasswordMatch |
64 | toFormattedJSON: UserMethods.ToFormattedJSON | 65 | toFormattedJSON: UserMethods.ToFormattedJSON |
65 | isAdmin: UserMethods.IsAdmin | 66 | hasRight: UserMethods.HasRight |
66 | } | 67 | } |
67 | 68 | ||
68 | export interface UserModel extends UserClass, Sequelize.Model<UserInstance, UserAttributes> {} | 69 | export interface UserModel extends UserClass, Sequelize.Model<UserInstance, UserAttributes> {} |