aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/core/auth/auth-user.model.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-07-30 09:59:19 +0200
committerChocobozzz <me@florianbigard.com>2019-07-30 09:59:19 +0200
commita95a4cc89155f448e6f9ca0957170f3c72a9d964 (patch)
treef390fa3eccef0991db5694ef58d6716228a7f67a /client/src/app/core/auth/auth-user.model.ts
parentdc8902634864841be7ca483b8e1c0f5afa609c32 (diff)
downloadPeerTube-a95a4cc89155f448e6f9ca0957170f3c72a9d964.tar.gz
PeerTube-a95a4cc89155f448e6f9ca0957170f3c72a9d964.tar.zst
PeerTube-a95a4cc89155f448e6f9ca0957170f3c72a9d964.zip
Moderators can only manage users
Diffstat (limited to 'client/src/app/core/auth/auth-user.model.ts')
-rw-r--r--client/src/app/core/auth/auth-user.model.ts9
1 files changed, 9 insertions, 0 deletions
diff --git a/client/src/app/core/auth/auth-user.model.ts b/client/src/app/core/auth/auth-user.model.ts
index abb11fdc2..334ede0cd 100644
--- a/client/src/app/core/auth/auth-user.model.ts
+++ b/client/src/app/core/auth/auth-user.model.ts
@@ -139,6 +139,15 @@ export class AuthUser extends User {
139 return hasUserRight(this.role, right) 139 return hasUserRight(this.role, right)
140 } 140 }
141 141
142 canManage (user: ServerUserModel) {
143 const myRole = this.role
144
145 if (myRole === UserRole.ADMINISTRATOR) return true
146
147 // I'm a moderator: I can only manage users
148 return user.role === UserRole.USER
149 }
150
142 save () { 151 save () {
143 peertubeLocalStorage.setItem(AuthUser.KEYS.ID, this.id.toString()) 152 peertubeLocalStorage.setItem(AuthUser.KEYS.ID, this.id.toString())
144 peertubeLocalStorage.setItem(AuthUser.KEYS.USERNAME, this.username) 153 peertubeLocalStorage.setItem(AuthUser.KEYS.USERNAME, this.username)