Merge pull request #4985 from tsiegleauq/more-mediafile-permission

Add more permission checks to file manager
This commit is contained in:
Emanuel Schütze 2019-09-06 12:16:37 +02:00 committed by GitHub
commit 84bb091e0f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 15 deletions

View File

@ -172,8 +172,9 @@
<!-- Menu for single files in the list --> <!-- Menu for single files in the list -->
<mat-menu #singleMediafileMenu="matMenu"> <mat-menu #singleMediafileMenu="matMenu">
<ng-template matMenuContent let-mediafile="mediafile"> <ng-template matMenuContent let-mediafile="mediafile">
<div *osPerms="'core.can_manage_logos_and_fonts'">
<!-- Exclusive for images --> <!-- Exclusive for images -->
<div *ngIf="mediafile.isImage() && canEdit"> <div *ngIf="mediafile.isImage()">
<div *ngFor="let action of logoActions"> <div *ngFor="let action of logoActions">
<ng-container <ng-container
*ngTemplateOutlet="manageButton; context: { mediafile: mediafile, action: action }" *ngTemplateOutlet="manageButton; context: { mediafile: mediafile, action: action }"
@ -182,16 +183,17 @@
</div> </div>
<!-- Exclusive for fonts --> <!-- Exclusive for fonts -->
<div *ngIf="mediafile.isFont() && canEdit"> <div *ngIf="mediafile.isFont()">
<div *ngFor="let action of fontActions"> <div *ngFor="let action of fontActions">
<ng-container <ng-container
*ngTemplateOutlet="manageButton; context: { mediafile: mediafile, action: action }" *ngTemplateOutlet="manageButton; context: { mediafile: mediafile, action: action }"
></ng-container> ></ng-container>
</div> </div>
</div> </div>
<mat-divider *ngIf="mediafile.isFont() || mediafile.isImage()"></mat-divider>
</div>
<!-- Edit and delete for all images --> <!-- Edit and delete for all images -->
<mat-divider *ngIf="mediafile.isFont() || mediafile.isImage()"></mat-divider>
<os-projector-button <os-projector-button
*ngIf="mediafile.isProjectable()" *ngIf="mediafile.isProjectable()"
[object]="mediafile" [object]="mediafile"

View File

@ -81,6 +81,7 @@ export class MediafileListComponent extends BaseListViewComponent<ViewMediafile>
return ( return (
this.operator.hasPerms('core.can_manage_projector') || this.operator.hasPerms('core.can_manage_projector') ||
this.operator.hasPerms('agenda.can_see_list_of_speakers') || this.operator.hasPerms('agenda.can_see_list_of_speakers') ||
this.operator.hasPerms('core.can_manage_logos_and_fonts') ||
this.canEdit this.canEdit
); );
} }
@ -253,6 +254,8 @@ export class MediafileListComponent extends BaseListViewComponent<ViewMediafile>
return ( return (
this.operator.hasPerms('agenda.can_see_list_of_speakers') || this.operator.hasPerms('agenda.can_see_list_of_speakers') ||
(file.isProjectable() && this.operator.hasPerms('core.can_manage_projector')) || (file.isProjectable() && this.operator.hasPerms('core.can_manage_projector')) ||
(file.isFont() && this.operator.hasPerms('core.can_manage_logos_and_fonts')) ||
(file.isImage() && this.operator.hasPerms('core.can_manage_logos_and_fonts')) ||
this.canEdit this.canEdit
); );
} }
@ -433,7 +436,9 @@ export class MediafileListComponent extends BaseListViewComponent<ViewMediafile>
public onManageButton(event: any, file: ViewMediafile, action: string): void { public onManageButton(event: any, file: ViewMediafile, action: string): void {
// prohibits automatic closing // prohibits automatic closing
event.stopPropagation(); event.stopPropagation();
this.mediaManage.setAs(file, action); this.mediaManage.setAs(file, action).then(() => {
this.cd.markForCheck();
});
} }
public createNewFolder(templateRef: TemplateRef<string>): void { public createNewFolder(templateRef: TemplateRef<string>): void {