import {
User as UserServerModel,
UserRole,
- VideoChannel
+ VideoChannel,
+ UserRight,
+ hasUserRight
} from '../../../../../shared'
export type UserConstructorHash = {
videoQuota?: number,
displayNSFW?: boolean,
createdAt?: Date,
- author?: {
+ account?: {
id: number
uuid: string
},
role: UserRole
displayNSFW: boolean
videoQuota: number
- author: {
+ account: {
id: number
uuid: string
}
this.username = hash.username
this.email = hash.email
this.role = hash.role
- this.author = hash.author
+ this.account = hash.account
if (hash.videoChannels !== undefined) {
this.videoChannels = hash.videoChannels
}
}
- isAdmin () {
- return this.role === 'admin'
+ hasRight (right: UserRight) {
+ return hasUserRight(this.role, right)
}
}