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

View File

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