Skip to content
Snippets Groups Projects
Commit 91e98eef authored by Alex ORLUC's avatar Alex ORLUC
Browse files

fix suspend user if admin

parent ac03d84f
No related branches found
No related tags found
No related merge requests found
...@@ -33,9 +33,9 @@ ...@@ -33,9 +33,9 @@
</ng-container> </ng-container>
<ng-container *ngIf="!data.inDiffListDest && !data.isResDestUser"> <ng-container *ngIf="!data.inDiffListDest && !data.isResDestUser">
<div class="alert" role="alert"> <div class="alert" role="alert">
<b *ngIf="data.userDestRedirect.mode == 'delete'">{{lang.delete}} <b *ngIf="data.userDestRedirect.actionMode == 'delete'">{{lang.delete}}
{{this.data.userDestRedirect.firstname}} {{this.data.userDestRedirect.lastname}}</b>&nbsp; {{this.data.userDestRedirect.firstname}} {{this.data.userDestRedirect.lastname}}</b>&nbsp;
<b *ngIf="data.userDestRedirect.mode == 'suspend'">{{lang.suspend}} <b *ngIf="data.userDestRedirect.actionMode == 'suspend'">{{lang.suspend}}
{{this.data.userDestRedirect.firstname}} {{this.data.userDestRedirect.lastname}}</b>&nbsp; {{this.data.userDestRedirect.firstname}} {{this.data.userDestRedirect.lastname}}</b>&nbsp;
</div> </div>
</ng-container> </ng-container>
...@@ -68,11 +68,11 @@ ...@@ -68,11 +68,11 @@
</mat-dialog-content> </mat-dialog-content>
<span class="divider-modal"></span> <span class="divider-modal"></span>
<mat-dialog-actions> <mat-dialog-actions>
<button mat-raised-button color="warn" *ngIf="data.userDestRedirect.mode == 'delete' && data.isDeletable" <button mat-raised-button color="warn" *ngIf="data.userDestRedirect.actionMode == 'delete' && data.isDeletable"
type="submit" class="btn btn-danger" (click)="dialogRef.close(this.data)" type="submit" class="btn btn-danger" (click)="dialogRef.close(this.data)"
[disabled]="!sendFunction()">{{lang.delete}} [disabled]="!sendFunction()">{{lang.delete}}
{{lang.user}}</button> {{lang.user}}</button>
<button mat-raised-button color="primary" *ngIf="data.userDestRedirect.mode == 'suspend' && data.isDeletable" <button mat-raised-button color="primary" *ngIf="data.userDestRedirect.actionMode == 'suspend' && data.isDeletable"
type="submit" (click)="dialogRef.close(this.data)" [disabled]="!sendFunction()">{{lang.suspend}} type="submit" (click)="dialogRef.close(this.data)" [disabled]="!sendFunction()">{{lang.suspend}}
{{lang.user}}</button> {{lang.user}}</button>
<button mat-raised-button color="primary" *ngIf="!data.isDeletable" type="submit" <button mat-raised-button color="primary" *ngIf="!data.isDeletable" type="submit"
......
...@@ -95,13 +95,13 @@ ...@@ -95,13 +95,13 @@
<mat-header-cell *matHeaderCellDef> <mat-header-cell *matHeaderCellDef>
</mat-header-cell> </mat-header-cell>
<mat-cell *matCellDef="let element" style="justify-content: flex-end;"> <mat-cell *matCellDef="let element" style="justify-content: flex-end;">
<button mat-icon-button color="primary" [disabled]="element.id===user.id" <button mat-icon-button color="primary" [disabled]="element.id===user.id || (['root_visible', 'root_invisible'].indexOf(element.mode) > -1 && headerService.user.mode === 'standard')"
*ngIf="element.status != 'SPD'" matTooltip="{{lang.suspend}}" *ngIf="element.status != 'SPD'" matTooltip="{{lang.suspend}}"
(click)="$event.stopPropagation();deleteUser(element, 'suspend')"> (click)="$event.stopPropagation();deleteUser(element, 'suspend')">
<mat-icon class="fa fa-pause fa-2x" aria-hidden="true"></mat-icon> <mat-icon class="fa fa-pause fa-2x" aria-hidden="true"></mat-icon>
</button> </button>
<button mat-icon-button color="accent" *ngIf="element.status == 'SPD'" <button mat-icon-button color="accent" *ngIf="element.status == 'SPD'"
matTooltip="{{lang.authorize}}" matTooltip="{{lang.authorize}}" [disabled]="['root_visible', 'root_invisible'].indexOf(element.mode) > -1 && headerService.user.mode === 'standard'"
(click)="$event.stopPropagation();activateUser(element)"> (click)="$event.stopPropagation();activateUser(element)">
<mat-icon class="fa fa-check fa-2x" aria-hidden="true"></mat-icon> <mat-icon class="fa fa-check fa-2x" aria-hidden="true"></mat-icon>
</button> </button>
......
...@@ -55,7 +55,7 @@ export class UsersAdministrationComponent implements OnInit { ...@@ -55,7 +55,7 @@ export class UsersAdministrationComponent implements OnInit {
public http: HttpClient, public http: HttpClient,
private notify: NotificationService, private notify: NotificationService,
public dialog: MatDialog, public dialog: MatDialog,
private headerService: HeaderService, public headerService: HeaderService,
public appService: AppService, public appService: AppService,
public functions: FunctionsService, public functions: FunctionsService,
private viewContainerRef: ViewContainerRef private viewContainerRef: ViewContainerRef
...@@ -127,7 +127,7 @@ export class UsersAdministrationComponent implements OnInit { ...@@ -127,7 +127,7 @@ export class UsersAdministrationComponent implements OnInit {
} }
deleteUser(user: any, mode: string) { deleteUser(user: any, mode: string) {
user.mode = mode; user.actionMode = mode;
this.http.get('../rest/users/' + user.id + '/isDeletable') this.http.get('../rest/users/' + user.id + '/isDeletable')
.subscribe((response: any) => { .subscribe((response: any) => {
...@@ -197,7 +197,7 @@ export class UsersAdministrationComponent implements OnInit { ...@@ -197,7 +197,7 @@ export class UsersAdministrationComponent implements OnInit {
} else { } else {
// delete user // delete user
if (user.mode === 'delete') { if (user.actionMode === 'delete') {
this.http.delete('../rest/users/' + user.id) this.http.delete('../rest/users/' + user.id)
.subscribe(() => { .subscribe(() => {
for (const i in this.data) { for (const i in this.data) {
...@@ -220,7 +220,7 @@ export class UsersAdministrationComponent implements OnInit { ...@@ -220,7 +220,7 @@ export class UsersAdministrationComponent implements OnInit {
this.notify.error(err.error.errors); this.notify.error(err.error.errors);
}); });
// suspend user // suspend user
} else if (user.mode === 'suspend') { } else if (user.actionMode === 'suspend') {
this.http.put('../rest/users/' + user.id + '/suspend', user) this.http.put('../rest/users/' + user.id + '/suspend', user)
.subscribe(() => { .subscribe(() => {
user.status = 'SPD'; user.status = 'SPD';
...@@ -249,7 +249,7 @@ export class UsersAdministrationComponent implements OnInit { ...@@ -249,7 +249,7 @@ export class UsersAdministrationComponent implements OnInit {
this.http.put('../rest/listTemplates/entityDest/itemId/' + user.id, user) this.http.put('../rest/listTemplates/entityDest/itemId/' + user.id, user)
.subscribe(() => { .subscribe(() => {
// delete user // delete user
if (user.mode === 'delete') { if (user.actionMode === 'delete') {
this.http.delete('../rest/users/' + user.id) this.http.delete('../rest/users/' + user.id)
.subscribe(() => { .subscribe(() => {
for (const i in this.data) { for (const i in this.data) {
...@@ -272,7 +272,7 @@ export class UsersAdministrationComponent implements OnInit { ...@@ -272,7 +272,7 @@ export class UsersAdministrationComponent implements OnInit {
this.notify.error(err.error.errors); this.notify.error(err.error.errors);
}); });
// suspend user // suspend user
} else if (user.mode === 'suspend') { } else if (user.actionMode === 'suspend') {
this.http.put('../rest/users/' + user.id + '/suspend', user) this.http.put('../rest/users/' + user.id + '/suspend', user)
.subscribe(() => { .subscribe(() => {
user.status = 'SPD'; user.status = 'SPD';
...@@ -300,7 +300,7 @@ export class UsersAdministrationComponent implements OnInit { ...@@ -300,7 +300,7 @@ export class UsersAdministrationComponent implements OnInit {
} else { } else {
// delete user // delete user
if (user.mode === 'delete') { if (user.actionMode === 'delete') {
this.http.delete('../rest/users/' + user.id) this.http.delete('../rest/users/' + user.id)
.subscribe(() => { .subscribe(() => {
for (const i in this.data) { for (const i in this.data) {
...@@ -323,7 +323,7 @@ export class UsersAdministrationComponent implements OnInit { ...@@ -323,7 +323,7 @@ export class UsersAdministrationComponent implements OnInit {
this.notify.error(err.error.errors); this.notify.error(err.error.errors);
}); });
// suspend user // suspend user
} else if (user.mode === 'suspend') { } else if (user.actionMode === 'suspend') {
this.http.put('../rest/users/' + user.id + '/suspend', user) this.http.put('../rest/users/' + user.id + '/suspend', user)
.subscribe(() => { .subscribe(() => {
user.status = 'SPD'; user.status = 'SPD';
...@@ -347,7 +347,7 @@ export class UsersAdministrationComponent implements OnInit { ...@@ -347,7 +347,7 @@ export class UsersAdministrationComponent implements OnInit {
} else if (!user.inDiffListDest && !user.isResDestUser) { // user is not inDiffListDest and is not isResDestUser } else if (!user.inDiffListDest && !user.isResDestUser) { // user is not inDiffListDest and is not isResDestUser
// delete user // delete user
if (user.mode === 'delete') { if (user.actionMode === 'delete') {
this.http.delete('../rest/users/' + user.id) this.http.delete('../rest/users/' + user.id)
.subscribe(() => { .subscribe(() => {
for (const i in this.data) { for (const i in this.data) {
...@@ -370,7 +370,7 @@ export class UsersAdministrationComponent implements OnInit { ...@@ -370,7 +370,7 @@ export class UsersAdministrationComponent implements OnInit {
this.notify.error(err.error.errors); this.notify.error(err.error.errors);
}); });
// suspend user // suspend user
} else if (user.mode === 'suspend') { } else if (user.actionMode === 'suspend') {
this.http.put('../rest/users/' + user.id + '/suspend', user) this.http.put('../rest/users/' + user.id + '/suspend', user)
.subscribe(() => { .subscribe(() => {
user.status = 'SPD'; user.status = 'SPD';
...@@ -438,7 +438,7 @@ export class UsersAdministrationRedirectModalComponent implements OnInit { ...@@ -438,7 +438,7 @@ export class UsersAdministrationRedirectModalComponent implements OnInit {
this.data.isResDestUser = true; this.data.isResDestUser = true;
} }
} else { } else {
if (this.data.userDestRedirect.mode === 'delete') { if (this.data.userDestRedirect.actionMode === 'delete') {
this.modalTitle = this.lang.unableToDelete; this.modalTitle = this.lang.unableToDelete;
} else { } else {
this.modalTitle = this.lang.unableToSuspend; this.modalTitle = this.lang.unableToSuspend;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment