mirror of
https://github.com/booklore-app/booklore.git
synced 2026-02-18 00:17:53 +01:00
Fix: Restrict book downloads in PDF viewer for users lacking download permissions (#1326)
This commit is contained in:
@@ -87,7 +87,6 @@ export class BookCardComponent implements OnInit, OnChanges, OnDestroy {
|
||||
|
||||
ngOnChanges(changes: SimpleChanges): void {
|
||||
if (changes['book'] && !changes['book'].firstChange) {
|
||||
// Reset the flag when book changes
|
||||
this.additionalFilesLoaded = false;
|
||||
this.initMenu();
|
||||
}
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
[zoom]="zoom"
|
||||
[spread]="spread"
|
||||
[showBookModeButton]="false"
|
||||
[showDownloadButton]="showDownloadButton"
|
||||
[showPrintButton]="showPrintButton"
|
||||
(pagesLoaded)="onPdfPagesLoaded($event)"
|
||||
(pageChange)="onPageChange($event)"
|
||||
(zoomChange)="onZoomChange($event)"
|
||||
|
||||
@@ -25,6 +25,9 @@ export class PdfViewerComponent implements OnInit, OnDestroy {
|
||||
spread!: 'off' | 'even' | 'odd';
|
||||
zoom!: number | string;
|
||||
|
||||
showDownloadButton = false;
|
||||
showPrintButton = false;
|
||||
|
||||
bookData!: string | Blob;
|
||||
bookId!: number;
|
||||
private appSettingsSubscription!: Subscription;
|
||||
@@ -51,6 +54,9 @@ export class PdfViewerComponent implements OnInit, OnDestroy {
|
||||
const pdfData = results[2];
|
||||
const myself = results[3];
|
||||
|
||||
this.showDownloadButton = myself.permissions.canDownload || myself.permissions.admin;
|
||||
this.showPrintButton = myself.permissions.canDownload || myself.permissions.admin;
|
||||
|
||||
let globalOrIndividual = myself.userSettings.perBookSetting.pdf;
|
||||
if (globalOrIndividual === 'Global') {
|
||||
this.zoom = myself.userSettings.pdfReaderSetting.pageZoom || 'page-fit';
|
||||
|
||||
Reference in New Issue
Block a user