From a95a4cc89155f448e6f9ca0957170f3c72a9d964 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 30 Jul 2019 09:59:19 +0200 Subject: Moderators can only manage users --- client/src/app/core/auth/auth-user.model.ts | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'client/src/app/core/auth') 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 { return hasUserRight(this.role, right) } + canManage (user: ServerUserModel) { + const myRole = this.role + + if (myRole === UserRole.ADMINISTRATOR) return true + + // I'm a moderator: I can only manage users + return user.role === UserRole.USER + } + save () { peertubeLocalStorage.setItem(AuthUser.KEYS.ID, this.id.toString()) peertubeLocalStorage.setItem(AuthUser.KEYS.USERNAME, this.username) -- cgit v1.2.3