- this.confirmService.confirm('Do you really want to delete this user?', 'Delete').subscribe(
- res => {
- if (res === false) return
+ this.userBanModal.openModal(user)
+ }
+
+ onUserBanned () {
+ this.loadData()
+ }
+
+ async unbanUser (user: User) {
+ const message = this.i18n('Do you really want to unban {{username}}?', { username: user.username })
+ const res = await this.confirmService.confirm(message, this.i18n('Unban'))
+ if (res === false) return
+
+ this.userService.unbanUser(user)
+ .subscribe(
+ () => {
+ this.notificationsService.success(
+ this.i18n('Success'),
+ this.i18n('User {{username}} unbanned.', { username: user.username })
+ )
+ this.loadData()
+ },
+
+ err => this.notificationsService.error(this.i18n('Error'), err.message)
+ )
+ }
+
+ async removeUser (user: User) {
+ if (user.username === 'root') {
+ this.notificationsService.error(this.i18n('Error'), this.i18n('You cannot delete root.'))
+ return
+ }