diff options
Diffstat (limited to 'client/src/app/core/auth')
-rw-r--r-- | client/src/app/core/auth/auth-user.model.ts | 9 |
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) |