This is an automated email from the ASF dual-hosted git repository.

dgnatyshyn pushed a commit to branch DLAB-1571
in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git


The following commit(s) were added to refs/heads/DLAB-1571 by this push:
     new c4a379d  [DLAB-1701]: Project_admin should not be able to remove 
administrative operation for all Dlab from Super_admin
c4a379d is described below

commit c4a379d251b94a2d3e29e3b4377cb630aefbd03c
Author: Dmytro Gnatyshyn <di1...@ukr.net>
AuthorDate: Tue Apr 14 13:47:20 2020 +0300

    [DLAB-1701]: Project_admin should not be able to remove administrative 
operation for all Dlab from Super_admin
---
 .../webapp/src/app/administration/roles/roles.component.html  | 11 +++++++----
 .../webapp/src/app/administration/roles/roles.component.ts    |  2 +-
 .../multi-level-select-dropdown.component.html                |  8 ++++++--
 .../multi-level-select-dropdown.component.scss                |  4 ++++
 .../multi-level-select-dropdown.component.ts                  |  1 +
 5 files changed, 19 insertions(+), 7 deletions(-)

diff --git 
a/services/self-service/src/main/resources/webapp/src/app/administration/roles/roles.component.html
 
b/services/self-service/src/main/resources/webapp/src/app/administration/roles/roles.component.html
index 87e27a2..5c73329 100644
--- 
a/services/self-service/src/main/resources/webapp/src/app/administration/roles/roles.component.html
+++ 
b/services/self-service/src/main/resources/webapp/src/app/administration/roles/roles.component.html
@@ -36,7 +36,7 @@
       <mat-step [completed]='false'>
         <ng-template matStepLabel>Groups</ng-template>
         <div class="inner-step mat-reset">
-          <input [validator]="groupValidarion()" type="text" 
placeholder="Enter group name" [(ngModel)]="setupGroup"
+          <input [validator]="groupValidation()" type="text" 
placeholder="Enter group name" [(ngModel)]="setupGroup"
             #setupGroupName="ngModel">
           <div class="error" *ngIf="setupGroupName.errors?.patterns && 
setupGroupName.dirty">Group name can only
             contain letters, numbers, hyphens and '_'</div>
@@ -72,7 +72,9 @@
               (selectionChange)="onUpdate($event)"
               name="roles"
               [items]="rolesList"
-              [model]="setupRoles">
+              [model]="setupRoles"
+              [isAdmin]="healthStatus?.admin"
+            >
             </multi-level-select-dropdown>
           </div>
         </div>
@@ -104,8 +106,9 @@
                 (selectionChange)="onUpdate($event)"
                 [type]="element.group"
                 [items]="rolesList"
-                [model]="element.selected_roles">
-
+                [model]="element.selected_roles"
+                [isAdmin]="healthStatus?.admin"
+              >
               </multi-level-select-dropdown>
           </div>
         </td>
diff --git 
a/services/self-service/src/main/resources/webapp/src/app/administration/roles/roles.component.ts
 
b/services/self-service/src/main/resources/webapp/src/app/administration/roles/roles.component.ts
index bf57438..e36205a 100644
--- 
a/services/self-service/src/main/resources/webapp/src/app/administration/roles/roles.component.ts
+++ 
b/services/self-service/src/main/resources/webapp/src/app/administration/roles/roles.component.ts
@@ -217,7 +217,7 @@ export class RolesComponent implements OnInit {
     this.startedGroups = JSON.parse(JSON.stringify(this.groupsData));
   }
 
-  public groupValidarion(): ValidatorFn {
+  public groupValidation(): ValidatorFn {
     const duplicateList: any = this.groupsData.map(item => 
item.group.toLowerCase());
     return <ValidatorFn>((control: FormControl) => {
       if (control.value && 
duplicateList.includes(CheckUtils.delimitersFiltering(control.value.toLowerCase())))
 {
diff --git 
a/services/self-service/src/main/resources/webapp/src/app/shared/form-controls/multi-level-select-dropdown/multi-level-select-dropdown.component.html
 
b/services/self-service/src/main/resources/webapp/src/app/shared/form-controls/multi-level-select-dropdown/multi-level-select-dropdown.component.html
index f2d3051..c0162da 100644
--- 
a/services/self-service/src/main/resources/webapp/src/app/shared/form-controls/multi-level-select-dropdown/multi-level-select-dropdown.component.html
+++ 
b/services/self-service/src/main/resources/webapp/src/app/shared/form-controls/multi-level-select-dropdown/multi-level-select-dropdown.component.html
@@ -38,7 +38,7 @@
       </li>
 
         <ng-template  ngFor let-item [ngForOf]="items" let-i="index">
-          <li class="role-label" role="presentation" *ngIf="i === 0 || model 
&& item.type !== items[i - 1].type" (click)="toggleItemsForLable(item.type, 
$event)">
+          <li class="role-label" role="presentation" *ngIf="i === 0 || model 
&& item.type !== items[i - 1].type" (click)="toggleItemsForLable(item.type, 
$event)" >
             <a href="#" class="list-item" role="menuitem">
               <span class="arrow" [ngClass]="{'rotate-arrow': 
isOpenCategory[item.type], 'arrow-checked': selectedAllInCattegory(item.type) 
|| selectedSomeInCattegory(item.type)}">
                 <i class="material-icons">keyboard_arrow_right</i>
@@ -51,7 +51,11 @@
             </a>
           </li>
 
-          <li class="role-item" role="presentation" *ngIf="model && 
isOpenCategory[item.type] && item.type !== 'COMPUTATIONAL_SHAPE' && item.type 
!== 'NOTEBOOK_SHAPE'" >
+          <li class="role-item"
+              role="presentation"
+              *ngIf="model && isOpenCategory[item.type] && item.type !== 
'COMPUTATIONAL_SHAPE' && item.type !== 'NOTEBOOK_SHAPE'"
+              [ngClass]="{'d-none': !isAdmin && item.role === 'Allow to 
execute administration operation'}"
+          >
             <a href="#" class="list-item" role="menuitem" 
(click)="toggleSelectedOptions($event, model, item)">
               <span class="empty-checkbox" [ngClass]="{'checked': 
checkInModel(item.role)}">
                 <span class="checked-checkbox" 
*ngIf="checkInModel(item.role)"></span>
diff --git 
a/services/self-service/src/main/resources/webapp/src/app/shared/form-controls/multi-level-select-dropdown/multi-level-select-dropdown.component.scss
 
b/services/self-service/src/main/resources/webapp/src/app/shared/form-controls/multi-level-select-dropdown/multi-level-select-dropdown.component.scss
index 1902d15..a066dd5 100644
--- 
a/services/self-service/src/main/resources/webapp/src/app/shared/form-controls/multi-level-select-dropdown/multi-level-select-dropdown.component.scss
+++ 
b/services/self-service/src/main/resources/webapp/src/app/shared/form-controls/multi-level-select-dropdown/multi-level-select-dropdown.component.scss
@@ -318,3 +318,7 @@
   }
 }
 
+.d-none{
+  display: none;
+}
+
diff --git 
a/services/self-service/src/main/resources/webapp/src/app/shared/form-controls/multi-level-select-dropdown/multi-level-select-dropdown.component.ts
 
b/services/self-service/src/main/resources/webapp/src/app/shared/form-controls/multi-level-select-dropdown/multi-level-select-dropdown.component.ts
index cabf7d9..5b9c1a9 100644
--- 
a/services/self-service/src/main/resources/webapp/src/app/shared/form-controls/multi-level-select-dropdown/multi-level-select-dropdown.component.ts
+++ 
b/services/self-service/src/main/resources/webapp/src/app/shared/form-controls/multi-level-select-dropdown/multi-level-select-dropdown.component.ts
@@ -30,6 +30,7 @@ export class MultiLevelSelectDropdownComponent {
   @Input() items: Array<any>;
   @Input() model: Array<any>;
   @Input() type: string;
+  @Input() isAdmin: boolean;
   @Output() selectionChange: EventEmitter<{}> = new EventEmitter();
 
   public isOpenCategory = {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@dlab.apache.org
For additional commands, e-mail: commits-h...@dlab.apache.org

Reply via email to