Merge pull request #4365 from MaximilianKrambach/hideUserList
user detail page display permission update
This commit is contained in:
commit
6c8fbcfc07
@ -2,6 +2,7 @@
|
|||||||
[mainButton]="isAllowed('changePersonal')"
|
[mainButton]="isAllowed('changePersonal')"
|
||||||
mainButtonIcon="edit"
|
mainButtonIcon="edit"
|
||||||
[nav]="false"
|
[nav]="false"
|
||||||
|
[goBack]="!isAllowed('seeOtherUsers')"
|
||||||
[editMode]="editUser"
|
[editMode]="editUser"
|
||||||
(mainEvent)="setEditMode(!editUser)"
|
(mainEvent)="setEditMode(!editUser)"
|
||||||
(saveEvent)="saveUser()"
|
(saveEvent)="saveUser()"
|
||||||
@ -21,7 +22,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<mat-menu #userExtraMenu="matMenu">
|
<mat-menu #userExtraMenu="matMenu">
|
||||||
<button mat-menu-item *ngIf="isAllowed('changePersonal')" (click)="changePassword()">
|
<button mat-menu-item *ngIf="isAllowed('changePassword')" (click)="changePassword()">
|
||||||
<mat-icon>security</mat-icon>
|
<mat-icon>security</mat-icon>
|
||||||
<span translate>Change password</span>
|
<span translate>Change password</span>
|
||||||
</button>
|
</button>
|
||||||
@ -40,7 +41,7 @@
|
|||||||
</mat-menu>
|
</mat-menu>
|
||||||
</os-head-bar>
|
</os-head-bar>
|
||||||
|
|
||||||
<mat-card [ngClass]="editUser ? 'os-form-card' : 'os-card'" *osPerms="'users.can_see_name'">
|
<mat-card [ngClass]="editUser ? 'os-form-card' : 'os-card'" *ngIf="isAllowed('seeName')">
|
||||||
<form
|
<form
|
||||||
[ngClass]="{ 'mat-form-field-enabled': editUser }"
|
[ngClass]="{ 'mat-form-field-enabled': editUser }"
|
||||||
[formGroup]="personalInfoForm"
|
[formGroup]="personalInfoForm"
|
||||||
@ -156,7 +157,7 @@
|
|||||||
matInput
|
matInput
|
||||||
placeholder="{{ 'Initial password' | translate }}"
|
placeholder="{{ 'Initial password' | translate }}"
|
||||||
formControlName="default_password"
|
formControlName="default_password"
|
||||||
[value]="user.default_password"
|
[value]="user.default_password || ''"
|
||||||
/>
|
/>
|
||||||
<mat-hint align="end">Generate</mat-hint>
|
<mat-hint align="end">Generate</mat-hint>
|
||||||
<button
|
<button
|
||||||
@ -200,7 +201,7 @@
|
|||||||
matInput
|
matInput
|
||||||
placeholder="{{ 'Comment' | translate }}"
|
placeholder="{{ 'Comment' | translate }}"
|
||||||
formControlName="comment"
|
formControlName="comment"
|
||||||
[value]="user.comment"
|
[value]="user.comment || ''"
|
||||||
/>
|
/>
|
||||||
<mat-hint translate>Only for internal notes.</mat-hint>
|
<mat-hint translate>Only for internal notes.</mat-hint>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
@ -168,10 +168,12 @@ export class UserDetailComponent extends BaseViewComponent implements OnInit {
|
|||||||
* actions might be:
|
* actions might be:
|
||||||
* - delete (deleting the user) (users.can_manage and not ownPage)
|
* - delete (deleting the user) (users.can_manage and not ownPage)
|
||||||
* - seeName (title, 1st, last) (user.can_see_name or ownPage)
|
* - seeName (title, 1st, last) (user.can_see_name or ownPage)
|
||||||
|
* - seeOtherUsers (title, 1st, last) (user.can_see_name)
|
||||||
* - seeExtra (checkboxes, comment) (user.can_see_extra_data)
|
* - seeExtra (checkboxes, comment) (user.can_see_extra_data)
|
||||||
* - seePersonal (mail, username, about) (user.can_see_extra_data or ownPage)
|
* - seePersonal (mail, username, about) (user.can_see_extra_data or ownPage)
|
||||||
* - manage (everything) (user.can_manage)
|
* - manage (everything) (user.can_manage)
|
||||||
* - changePersonal (mail, username, about) (user.can_manage or ownPage)
|
* - changePersonal (mail, username, about) (user.can_manage or ownPage)
|
||||||
|
* - changePassword (user.can_change_password)
|
||||||
*
|
*
|
||||||
* @param action the action the user tries to perform
|
* @param action the action the user tries to perform
|
||||||
*/
|
*/
|
||||||
@ -183,12 +185,16 @@ export class UserDetailComponent extends BaseViewComponent implements OnInit {
|
|||||||
return this.operator.hasPerms('users.can_manage');
|
return this.operator.hasPerms('users.can_manage');
|
||||||
case 'seeName':
|
case 'seeName':
|
||||||
return this.operator.hasPerms('users.can_see_name', 'users.can_manage') || this.ownPage;
|
return this.operator.hasPerms('users.can_see_name', 'users.can_manage') || this.ownPage;
|
||||||
|
case 'seeOtherUsers':
|
||||||
|
return this.operator.hasPerms('users.can_see_name', 'users.can_manage');
|
||||||
case 'seeExtra':
|
case 'seeExtra':
|
||||||
return this.operator.hasPerms('users.can_see_extra_data', 'users.can_manage');
|
return this.operator.hasPerms('users.can_see_extra_data', 'users.can_manage');
|
||||||
case 'seePersonal':
|
case 'seePersonal':
|
||||||
return this.operator.hasPerms('users.can_see_extra_data', 'users.can_manage') || this.ownPage;
|
return this.operator.hasPerms('users.can_see_extra_data', 'users.can_manage') || this.ownPage;
|
||||||
case 'changePersonal':
|
case 'changePersonal':
|
||||||
return this.operator.hasPerms('users.can_manage') || this.ownPage;
|
return this.operator.hasPerms('users.can_manage') || this.ownPage;
|
||||||
|
case 'changePassword':
|
||||||
|
return this.ownPage && this.operator.hasPerms('users.can_change_password');
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user