mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-06 11:59:58 +02:00
Support roles with rights and add moderator role
This commit is contained in:
parent
e02573ad67
commit
954605a804
51 changed files with 378 additions and 139 deletions
|
@ -3,15 +3,16 @@ import * as Promise from 'bluebird'
|
|||
|
||||
// Don't use barrel, import just what we need
|
||||
import { User as FormattedUser } from '../../../shared/models/users/user.model'
|
||||
import { UserRole } from '../../../shared/models/users/user-role.type'
|
||||
import { ResultList } from '../../../shared/models/result-list.model'
|
||||
import { AuthorInstance } from '../video/author-interface'
|
||||
import { UserRight } from '../../../shared/models/users/user-right.enum'
|
||||
import { UserRole } from '../../../shared/models/users/user-role'
|
||||
|
||||
export namespace UserMethods {
|
||||
export type HasRight = (this: UserInstance, right: UserRight) => boolean
|
||||
export type IsPasswordMatch = (this: UserInstance, password: string) => Promise<boolean>
|
||||
|
||||
export type ToFormattedJSON = (this: UserInstance) => FormattedUser
|
||||
export type IsAdmin = (this: UserInstance) => boolean
|
||||
export type IsAbleToUploadVideo = (this: UserInstance, videoFile: Express.Multer.File) => Promise<boolean>
|
||||
|
||||
export type CountTotal = () => Promise<number>
|
||||
|
@ -31,7 +32,7 @@ export namespace UserMethods {
|
|||
export interface UserClass {
|
||||
isPasswordMatch: UserMethods.IsPasswordMatch,
|
||||
toFormattedJSON: UserMethods.ToFormattedJSON,
|
||||
isAdmin: UserMethods.IsAdmin,
|
||||
hasRight: UserMethods.HasRight,
|
||||
isAbleToUploadVideo: UserMethods.IsAbleToUploadVideo,
|
||||
|
||||
countTotal: UserMethods.CountTotal,
|
||||
|
@ -62,7 +63,7 @@ export interface UserInstance extends UserClass, UserAttributes, Sequelize.Insta
|
|||
|
||||
isPasswordMatch: UserMethods.IsPasswordMatch
|
||||
toFormattedJSON: UserMethods.ToFormattedJSON
|
||||
isAdmin: UserMethods.IsAdmin
|
||||
hasRight: UserMethods.HasRight
|
||||
}
|
||||
|
||||
export interface UserModel extends UserClass, Sequelize.Model<UserInstance, UserAttributes> {}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue