RED-5482: wip new permissions

This commit is contained in:
Dan Percic 2022-11-07 22:59:41 +02:00
parent 6e74f58912
commit 0d2b816263
6 changed files with 13 additions and 10 deletions

View File

@ -35,7 +35,7 @@
<iqser-circle-button
(action)="openRSSView(file)"
*ngIf="rssEnabled"
*allow="roles.getRss"
[tooltip]="'file-preview.open-rss-view' | translate"
class="ml-8"
icon="red:extract"

View File

@ -67,9 +67,9 @@ import { REDDocumentViewer } from '../pdf-viewer/services/document-viewer.servic
import { AnnotationsListingService } from './services/annotations-listing.service';
import { PdfProxyService } from './services/pdf-proxy.service';
import { ConfigService } from '@services/config.service';
import { TranslateService } from '@ngx-translate/core';
import Annotation = Core.Annotations.Annotation;
import { ReadableRedactionsService } from '../pdf-viewer/services/readable-redactions.service';
import { ROLES } from '@users/roles';
import Annotation = Core.Annotations.Annotation;
const textActions = [TextPopups.ADD_DICTIONARY, TextPopups.ADD_FALSE_POSITIVE];
@ -84,6 +84,7 @@ export class FilePreviewScreenComponent
implements AfterViewInit, OnInit, OnDestroy, OnAttach, OnDetach, ComponentCanDeactivate
{
readonly circleButtonTypes = CircleButtonTypes;
readonly roles = ROLES;
fullScreen = false;
readonly fileId = this.state.fileId;
readonly dossierId = this.state.dossierId;
@ -95,7 +96,6 @@ export class FilePreviewScreenComponent
})
private readonly _filterTemplate: TemplateRef<unknown>;
@ViewChild('actionsWrapper', { static: false }) private _actionsWrapper: ElementRef;
readonly rssEnabled: boolean;
constructor(
readonly pdf: PdfViewer,
@ -131,7 +131,6 @@ export class FilePreviewScreenComponent
private readonly _manualRedactionService: ManualRedactionService,
private readonly _filesService: FilesService,
private readonly _fileManagementService: FileManagementService,
private readonly _translateService: TranslateService,
private readonly _readableRedactionsService: ReadableRedactionsService,
private readonly _helpModeService: HelpModeService,
) {
@ -141,7 +140,6 @@ export class FilePreviewScreenComponent
this.fullScreen = false;
}
});
this.rssEnabled = 'true' === `${configService.values.RSS_ENABLED}`.toLowerCase();
}
get changed() {

View File

@ -8,6 +8,7 @@ import {
IqserHelpModeModule,
IqserIconsModule,
IqserInputsModule,
IqserPermissionsModule,
IqserScrollbarModule,
IqserSharedModule,
IqserUploadFileModule,
@ -119,6 +120,7 @@ const components = [
IqserEmptyStatesModule,
IqserFiltersModule,
IqserScrollbarModule,
IqserPermissionsModule,
],
providers: [FilePreviewDialogService, ManualRedactionService, DocumentUnloadedGuard],
})

View File

@ -174,7 +174,10 @@ export class FileActionsComponent implements OnChanges {
ariaExpanded: this._excludedPagesService?.shown$,
showDot: !!this.file.excludedPages?.length,
icon: 'red:exclude-pages',
show: !!this._excludedPagesService && !this.file.excluded,
show:
!!this._excludedPagesService &&
!this.file.excluded &&
this._permissionsService.canExcludePages(this.file, this.dossier),
},
{
type: ActionTypes.circleBtn,

View File

@ -74,7 +74,7 @@ export class PermissionsService {
}
showToggleAnalysis(dossier: Dossier): boolean {
return this._iqserPermissionsService.has(ROLES.files.reanalyze) && dossier.isActive;
return this._iqserPermissionsService.has(ROLES.excludeIncludeFile) && dossier.isActive;
}
canReanalyseFile(file: File | File[], dossier: Dossier): boolean {

View File

@ -1,8 +1,6 @@
export const ROLES = {
RED_CREATE_TENANT: 'red-create-tenant',
RED_DEPLOYMENT_INFO: 'red-deployment-info',
RED_EXCLUDE_INCLUDE_FILE: 'red-exclude-include-file',
RED_GET_RSS: 'red-get-rss',
RED_GET_TENANTS: 'red-get-tenants',
RED_MANAGE_USER_PREFERENCES: 'red-manage-user-preferences',
RED_PROCESS_DOWNLOAD: 'red-process-download',
@ -13,6 +11,8 @@ export const ROLES = {
RED_ROTATE_PAGE: 'red-rotate-page',
RED_UPDATE_MY_PROFILE: 'red-update-my-profile',
RED_WRITE_RULES: 'red-write-rules',
getRss: 'red-get-rss',
excludeIncludeFile: 'red-exclude-include-file',
excludeIncludePages: 'red-exclude-include-pages',
manageViewedPages: 'red-manage-viewed-pages',
setReviewer: 'red-set-reviewer',