mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-30 03:56:23 -05:00 
			
		
		
		
	implement superuser select-permissions disable
This commit is contained in:
		| @@ -17,8 +17,8 @@ | |||||||
|               <label class="form-check-label" for="is_active" i18n>Active</label> |               <label class="form-check-label" for="is_active" i18n>Active</label> | ||||||
|             </div> |             </div> | ||||||
|             <div class="form-check form-switch form-check-inline"> |             <div class="form-check form-switch form-check-inline"> | ||||||
|               <input type="checkbox" class="form-check-input" id="is_superuser" formControlName="is_superuser"> |               <input type="checkbox" class="form-check-input" id="is_superuser" formControlName="is_superuser" (change)="onToggleSuperUser()"> | ||||||
|               <label class="form-check-label" for="is_superuser" i18n>Superuser</label> |               <label class="form-check-label" for="is_superuser"><ng-container i18n>Superuser</ng-container> <small class="form-text text-muted ms-1" i18n>(Grants all permissions)</small></label> | ||||||
|             </div> |             </div> | ||||||
|           </div> |           </div> | ||||||
|  |  | ||||||
|   | |||||||
| @@ -48,4 +48,12 @@ export class UserEditDialogComponent extends EditDialogComponent<PaperlessUser> | |||||||
|       user_permissions: new FormControl(null), |       user_permissions: new FormControl(null), | ||||||
|     }) |     }) | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  |   onToggleSuperUser() { | ||||||
|  |     if (this.objectForm.get('is_superuser').value) { | ||||||
|  |       this.objectForm.get('user_permissions').disable() | ||||||
|  |     } else { | ||||||
|  |       this.objectForm.get('user_permissions').enable() | ||||||
|  |     } | ||||||
|  |   } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -1,4 +1,4 @@ | |||||||
| <form [formGroup]="form"> | <form [formGroup]="form" [class.opacity-50]="disabled"> | ||||||
|   <label class="form-label">{{title}}</label> |   <label class="form-label">{{title}}</label> | ||||||
|   <ul class="list-group"> |   <ul class="list-group"> | ||||||
|     <li class="list-group-item d-flex"> |     <li class="list-group-item d-flex"> | ||||||
| @@ -13,12 +13,12 @@ | |||||||
|       <div class="col-3">{{type.key}}:</div> |       <div class="col-3">{{type.key}}:</div> | ||||||
|  |  | ||||||
|       <div class="col form-check form-check-inline form-switch"> |       <div class="col form-check form-check-inline form-switch"> | ||||||
|         <input type="checkbox" class="form-check-input" id="{{type.key}}_all" (change)="toggleAll($event, type.key)" [checked]="typesWithAllActions.has(type.key)"> |         <input type="checkbox" class="form-check-input" id="{{type.key}}_all" (change)="toggleAll($event, type.key)" [checked]="typesWithAllActions.has(type.key)" [attr.disabled]="disabled ? true : null"> | ||||||
|         <label class="form-check-label visually-hidden" for="{{type.key}}_all" i18n>All</label> |         <label class="form-check-label visually-hidden" for="{{type.key}}_all" i18n>All</label> | ||||||
|       </div> |       </div> | ||||||
|  |  | ||||||
|       <div *ngFor="let action of PermissionAction | keyvalue" class="col form-check form-check-inline"> |       <div *ngFor="let action of PermissionAction | keyvalue" class="col form-check form-check-inline"> | ||||||
|         <input type="checkbox" class="form-check-input" id="{{type.key}}_{{action.key}}" formControlName="{{action.key}}" [attr.disabled]="typesWithAllActions.has(type.key) ? true : null"> |         <input type="checkbox" class="form-check-input" id="{{type.key}}_{{action.key}}" formControlName="{{action.key}}" [attr.disabled]="typesWithAllActions.has(type.key) || disabled ? true : null"> | ||||||
|         <label class="form-check-label visually-hidden" for="{{type.key}}_{{action.key}}" i18n>{{action.key}}</label> |         <label class="form-check-label visually-hidden" for="{{type.key}}_{{action.key}}" i18n>{{action.key}}</label> | ||||||
|       </div> |       </div> | ||||||
|     </li> |     </li> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Michael Shamoon
					Michael Shamoon