diff options
Diffstat (limited to 'client/src/app/+admin/users/user-list')
-rw-r--r-- | client/src/app/+admin/users/user-list/user-list.component.ts | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/client/src/app/+admin/users/user-list/user-list.component.ts b/client/src/app/+admin/users/user-list/user-list.component.ts index c9c790689..ab82713b2 100644 --- a/client/src/app/+admin/users/user-list/user-list.component.ts +++ b/client/src/app/+admin/users/user-list/user-list.component.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import { Component, OnInit, ViewChild } from '@angular/core' | 1 | import { Component, OnInit, ViewChild } from '@angular/core' |
2 | import { Notifier } from '@app/core' | 2 | import { AuthService, Notifier } from '@app/core' |
3 | import { SortMeta } from 'primeng/components/common/sortmeta' | 3 | import { SortMeta } from 'primeng/components/common/sortmeta' |
4 | import { ConfirmService, ServerService } from '../../../core' | 4 | import { ConfirmService, ServerService } from '../../../core' |
5 | import { RestPagination, RestTable, UserService } from '../../../shared' | 5 | import { RestPagination, RestTable, UserService } from '../../../shared' |
@@ -30,11 +30,16 @@ export class UserListComponent extends RestTable implements OnInit { | |||
30 | private confirmService: ConfirmService, | 30 | private confirmService: ConfirmService, |
31 | private serverService: ServerService, | 31 | private serverService: ServerService, |
32 | private userService: UserService, | 32 | private userService: UserService, |
33 | private auth: AuthService, | ||
33 | private i18n: I18n | 34 | private i18n: I18n |
34 | ) { | 35 | ) { |
35 | super() | 36 | super() |
36 | } | 37 | } |
37 | 38 | ||
39 | get authUser () { | ||
40 | return this.auth.getUser() | ||
41 | } | ||
42 | |||
38 | get requiresEmailVerification () { | 43 | get requiresEmailVerification () { |
39 | return this.serverService.getConfig().signup.requiresEmailVerification | 44 | return this.serverService.getConfig().signup.requiresEmailVerification |
40 | } | 45 | } |
@@ -45,22 +50,26 @@ export class UserListComponent extends RestTable implements OnInit { | |||
45 | this.bulkUserActions = [ | 50 | this.bulkUserActions = [ |
46 | { | 51 | { |
47 | label: this.i18n('Delete'), | 52 | label: this.i18n('Delete'), |
48 | handler: users => this.removeUsers(users) | 53 | handler: users => this.removeUsers(users), |
54 | isDisplayed: users => users.every(u => this.authUser.canManage(u)) | ||
49 | }, | 55 | }, |
50 | { | 56 | { |
51 | label: this.i18n('Ban'), | 57 | label: this.i18n('Ban'), |
52 | handler: users => this.openBanUserModal(users), | 58 | handler: users => this.openBanUserModal(users), |
53 | isDisplayed: users => users.every(u => u.blocked === false) | 59 | isDisplayed: users => users.every(u => this.authUser.canManage(u) && u.blocked === false) |
54 | }, | 60 | }, |
55 | { | 61 | { |
56 | label: this.i18n('Unban'), | 62 | label: this.i18n('Unban'), |
57 | handler: users => this.unbanUsers(users), | 63 | handler: users => this.unbanUsers(users), |
58 | isDisplayed: users => users.every(u => u.blocked === true) | 64 | isDisplayed: users => users.every(u => this.authUser.canManage(u) && u.blocked === true) |
59 | }, | 65 | }, |
60 | { | 66 | { |
61 | label: this.i18n('Set Email as Verified'), | 67 | label: this.i18n('Set Email as Verified'), |
62 | handler: users => this.setEmailsAsVerified(users), | 68 | handler: users => this.setEmailsAsVerified(users), |
63 | isDisplayed: users => this.requiresEmailVerification && users.every(u => !u.blocked && u.emailVerified === false) | 69 | isDisplayed: users => { |
70 | return this.requiresEmailVerification && | ||
71 | users.every(u => this.authUser.canManage(u) && !u.blocked && u.emailVerified === false) | ||
72 | } | ||
64 | } | 73 | } |
65 | ] | 74 | ] |
66 | } | 75 | } |