Motion block permission fixes

Adds fixes to motion block permission checks.
Users with "Can See motion"
Can see motion blocks in list view

The menu-column in motion blocks list will be completely hidden
without "Motion Can Manage" permissions

In motion block list view, the motion will be displayed with
identifier rather than just the title
This commit is contained in:
Sean Engelhardt 2019-03-08 12:16:02 +01:00 committed by Emanuel Schütze
parent 83ff758977
commit 6acecccc6e
3 changed files with 11 additions and 2 deletions

View File

@ -45,7 +45,9 @@
<!-- title column --> <!-- title column -->
<ng-container matColumnDef="title"> <ng-container matColumnDef="title">
<mat-header-cell *matHeaderCellDef mat-sort-header> <span translate>Motion</span> </mat-header-cell> <mat-header-cell *matHeaderCellDef mat-sort-header> <span translate>Motion</span> </mat-header-cell>
<mat-cell *matCellDef="let motion" (click)="onClickMotionTitle(motion)"> {{ motion.title }} </mat-cell> <mat-cell *matCellDef="let motion" (click)="onClickMotionTitle(motion)">
{{ motion.getTitle() }}
</mat-cell>
</ng-container> </ng-container>
<!-- state column --> <!-- state column -->

View File

@ -122,10 +122,13 @@ export class MotionBlockListComponent extends ListViewBaseComponent<ViewMotionBl
* @returns an array of strings building the column definition * @returns an array of strings building the column definition
*/ */
public getColumnDefinition(): string[] { public getColumnDefinition(): string[] {
let columns = ['title', 'amount', 'menu']; let columns = ['title', 'amount'];
if (this.operator.hasPerms('core.can_manage_projector')) { if (this.operator.hasPerms('core.can_manage_projector')) {
columns = ['projector'].concat(columns); columns = ['projector'].concat(columns);
} }
if (this.operator.hasPerms('motions.can_manage')) {
columns = columns.concat(['menu']);
}
return columns; return columns;
} }

View File

@ -165,10 +165,14 @@
<mat-icon>device_hub</mat-icon> <mat-icon>device_hub</mat-icon>
<span translate>Categories</span> <span translate>Categories</span>
</button> </button>
</div>
<div *ngIf="perms.isAllowed('manage') || motionBlocks.length">
<button mat-menu-item routerLink="blocks"> <button mat-menu-item routerLink="blocks">
<mat-icon>widgets</mat-icon> <mat-icon>widgets</mat-icon>
<span translate>Motion blocks</span> <span translate>Motion blocks</span>
</button> </button>
</div>
<div *ngIf="perms.isAllowed('manage')">
<button mat-menu-item routerLink="statute-paragraphs" *ngIf="statutesEnabled"> <button mat-menu-item routerLink="statute-paragraphs" *ngIf="statutesEnabled">
<mat-icon>account_balance</mat-icon> <mat-icon>account_balance</mat-icon>
<span translate>Statute</span> <span translate>Statute</span>