Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(still image): User without permission can draw a region #1372

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@
Copy IIIF URL to clipboard
</button>
<button class="menu-content" mat-menu-item (click)="download(images[0].fileValue.fileUrl)">Download image</button>
<button class="menu-content" mat-menu-item (click)="openReplaceFileDialog()">Replace file</button>
<button class="menu-content" mat-menu-item [disabled]="!adminPermissions" (click)="openReplaceFileDialog()">
Replace file
</button>
</mat-menu>
<!-- empty placeholder to simulate two buttons; this helps to have the zoom buttons centered with fill-remaining-space setup -->
<span class="empty-space"></span>
Expand Down Expand Up @@ -141,7 +143,7 @@
mat-icon-button
id="DSP_OSD_DRAW_REGION"
matTooltip="Draw Region"
[disabled]="failedToLoad"
[disabled]="failedToLoad || !adminPermissions"
(click)="drawButtonClicked()"
[class.active]="regionDrawMode">
<mat-icon svgIcon="draw_region_icon"></mat-icon>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ export class StillImageComponent implements OnChanges, OnDestroy, AfterViewInit
@Input() compoundNavigation?: DspCompoundPosition;
@Input() currentTab: string;
@Input() parentResource: ReadResource;
@Input() adminPermissions: boolean;

@Output() goToPage = new EventEmitter<number>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
[currentTab]="selectedTabLabel"
[parentResource]="incomingResource ? incomingResource.res : resource.res"
[activateRegion]="selectedRegion"
[adminPermissions]="isAdmin$ | async"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need to add an input adminPermission if you use the admin selector. You can add it straight to the component ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no equivalent selector yet as far as I can see (it is not sysadmin, it is sysadmin or project admin/member of the current project). So I went for a short streamlined fix reusing what is already there instead of refactoring and implementing new stuff as well.

(loaded)="representationLoaded($event)"
(goToPage)="compoundNavigation($event)"
(regionClicked)="openRegion($event)"
Expand Down