]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/shared/users/user.model.ts
Add account settings new design
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / users / user.model.ts
index 7beea5910958aa9638715bdb465350420e830413..b075ab717b60a61ad1e80b81eb72d3cd74995a6b 100644 (file)
@@ -1,7 +1,9 @@
 import {
   User as UserServerModel,
   UserRole,
-  VideoChannel
+  VideoChannel,
+  UserRight,
+  hasUserRight
 } from '../../../../../shared'
 
 export type UserConstructorHash = {
@@ -12,7 +14,7 @@ export type UserConstructorHash = {
   videoQuota?: number,
   displayNSFW?: boolean,
   createdAt?: Date,
-  author?: {
+  account?: {
     id: number
     uuid: string
   },
@@ -25,7 +27,7 @@ export class User implements UserServerModel {
   role: UserRole
   displayNSFW: boolean
   videoQuota: number
-  author: {
+  account: {
     id: number
     uuid: string
   }
@@ -37,7 +39,7 @@ export class User implements UserServerModel {
     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
@@ -56,7 +58,7 @@ export class User implements UserServerModel {
     }
   }
 
-  isAdmin () {
-    return this.role === 'admin'
+  hasRight (right: UserRight) {
+    return hasUserRight(this.role, right)
   }
 }