+
implements OnInit {
readonly iconButtonTypes = IconButtonTypes;
readonly circleButtonTypes = CircleButtonTypes;
- readonly currentUser = getCurrentUser();
+ readonly currentUser = getCurrentUser();
readonly translations = dossierAttributeTypesTranslations;
readonly tableHeaderLabel = _('dossier-attributes-listing.table-header.title');
readonly tableColumnConfigs: TableColumnConfig[] = [
@@ -36,9 +37,11 @@ export class DossierAttributesListingScreenComponent extends ListingComponent;
- readonly #dossierTemplateId: string = getParam(DOSSIER_TEMPLATE_ID);
+ readonly canEditDossierAttributes = this.permissionsService.canEditGlobalDossierAttributes();
+ readonly #dossierTemplateId = getParam(DOSSIER_TEMPLATE_ID);
constructor(
+ readonly permissionsService: PermissionsService,
private readonly _loadingService: LoadingService,
private readonly _dialogService: AdminDialogService,
private readonly _dossierAttributesService: DossierAttributesService,
diff --git a/apps/red-ui/src/app/modules/admin/screens/entities/screens/dictionary/dictionary-screen.component.html b/apps/red-ui/src/app/modules/admin/screens/entities/screens/dictionary/dictionary-screen.component.html
index ff89234fd..4200737b1 100644
--- a/apps/red-ui/src/app/modules/admin/screens/entities/screens/dictionary/dictionary-screen.component.html
+++ b/apps/red-ui/src/app/modules/admin/screens/entities/screens/dictionary/dictionary-screen.component.html
@@ -2,7 +2,7 @@
#dictionaryManager
(saveDictionary)="save()"
[canDownload]="permissionsService.canDownloadEntityDictionary()"
- [canEdit]="currentUser.isAdmin"
+ [canEdit]="currentUser.isAdmin && (iqserPermissionsService.has$(roles.dictionaryEntries.write) | async)"
[entityType]="entityType"
[filterByDossierTemplate]="true"
[initialEntries]="initialEntries$ | async"
diff --git a/apps/red-ui/src/app/modules/admin/screens/entities/screens/dictionary/dictionary-screen.component.ts b/apps/red-ui/src/app/modules/admin/screens/entities/screens/dictionary/dictionary-screen.component.ts
index 3a7ac6d6e..b5df24952 100644
--- a/apps/red-ui/src/app/modules/admin/screens/entities/screens/dictionary/dictionary-screen.component.ts
+++ b/apps/red-ui/src/app/modules/admin/screens/entities/screens/dictionary/dictionary-screen.component.ts
@@ -2,11 +2,11 @@ import { ChangeDetectionStrategy, Component, OnInit, ViewChild } from '@angular/
import { ActivatedRoute } from '@angular/router';
import { DictionaryManagerComponent } from '@shared/components/dictionary-manager/dictionary-manager.component';
import { DictionaryService } from '@services/entity-services/dictionary.service';
-import { List, LoadingService } from '@iqser/common-ui';
-import { UserService } from '@users/user.service';
+import { getCurrentUser, getParam, IqserPermissionsService, List, LoadingService } from '@iqser/common-ui';
import { BehaviorSubject, firstValueFrom } from 'rxjs';
import { DICTIONARY_TO_ENTRY_TYPE_MAP, DICTIONARY_TYPE_KEY_MAP, DictionaryType, DOSSIER_TEMPLATE_ID, ENTITY_TYPE, User } from '@red/domain';
import { PermissionsService } from '@services/permissions.service';
+import { ROLES } from '@users/roles';
@Component({
templateUrl: './dictionary-screen.component.html',
@@ -14,25 +14,23 @@ import { PermissionsService } from '@services/permissions.service';
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class DictionaryScreenComponent implements OnInit {
- readonly currentUser: User;
+ readonly currentUser = getCurrentUser();
+ readonly roles = ROLES;
readonly initialEntries$ = new BehaviorSubject([]);
isLeavingPage = false;
readonly type: DictionaryType;
- readonly entityType: string;
- readonly #dossierTemplateId: string;
+ readonly entityType = getParam(ENTITY_TYPE);
+ readonly #dossierTemplateId = getParam(DOSSIER_TEMPLATE_ID);
@ViewChild('dictionaryManager', { static: false })
private readonly _dictionaryManager: DictionaryManagerComponent;
constructor(
readonly route: ActivatedRoute,
- readonly userService: UserService,
readonly permissionsService: PermissionsService,
+ readonly iqserPermissionsService: IqserPermissionsService,
private readonly _loadingService: LoadingService,
private readonly _dictionaryService: DictionaryService,
) {
- this.currentUser = userService.currentUser;
- this.#dossierTemplateId = route.parent.snapshot.paramMap.get(DOSSIER_TEMPLATE_ID);
- this.entityType = route.parent.snapshot.paramMap.get(ENTITY_TYPE);
this.type = route.snapshot.routeConfig.path as DictionaryType;
}
diff --git a/apps/red-ui/src/app/modules/admin/screens/file-attributes-listing/file-attributes-listing-screen.component.html b/apps/red-ui/src/app/modules/admin/screens/file-attributes-listing/file-attributes-listing-screen.component.html
index d7713fdd4..adc800b6d 100644
--- a/apps/red-ui/src/app/modules/admin/screens/file-attributes-listing/file-attributes-listing-screen.component.html
+++ b/apps/red-ui/src/app/modules/admin/screens/file-attributes-listing/file-attributes-listing-screen.component.html
@@ -26,7 +26,7 @@
[itemSize]="80"
[noDataText]="'file-attributes-listing.no-data.title' | translate"
[noMatchText]="'file-attributes-listing.no-match.title' | translate"
- [selectionEnabled]="true"
+ [selectionEnabled]="permissionsService.canEditGlobalFileAttributes()"
[tableColumnConfigs]="tableColumnConfigs"
emptyColumnWidth="1fr"
noDataIcon="red:attribute"
@@ -46,7 +46,7 @@
@@ -129,7 +129,7 @@
-
+
implements OnInit, OnDestroy {
readonly iconButtonTypes = IconButtonTypes;
readonly circleButtonTypes = CircleButtonTypes;
- readonly currentUser = getCurrentUser();
+ readonly currentUser = getCurrentUser();
readonly translations = fileAttributeTypesTranslations;
readonly tableHeaderLabel = _('file-attributes-listing.table-header.title');
readonly tableColumnConfigs: TableColumnConfig[] = [
@@ -45,12 +47,14 @@ export class FileAttributesListingScreenComponent extends ListingComponent;
#existingConfiguration: IFileAttributesConfig;
@ViewChild('fileInput') private _fileInput: ElementRef;
readonly #dossierTemplateId = getParam(DOSSIER_TEMPLATE_ID);
constructor(
+ readonly permissionsService: PermissionsService,
private readonly _toaster: Toaster,
private readonly _loadingService: LoadingService,
private readonly _dialogService: AdminDialogService,
diff --git a/apps/red-ui/src/app/modules/admin/screens/justifications/justifications-screen/justifications-screen.component.html b/apps/red-ui/src/app/modules/admin/screens/justifications/justifications-screen/justifications-screen.component.html
index 8ad7ac075..016817b83 100644
--- a/apps/red-ui/src/app/modules/admin/screens/justifications/justifications-screen/justifications-screen.component.html
+++ b/apps/red-ui/src/app/modules/admin/screens/justifications/justifications-screen/justifications-screen.component.html
@@ -3,7 +3,7 @@
[headerTemplate]="headerTemplate"
[itemSize]="80"
[noDataText]="'justifications-listing.no-data.title' | translate"
- [selectionEnabled]="canUpdateJustifications"
+ [selectionEnabled]="canAddEditJustifications"
[tableColumnConfigs]="tableColumnConfigs"
noDataIcon="iqser:document"
>
@@ -11,7 +11,7 @@
{
this._loadingService.start();
await firstValueFrom(this._justificationService.loadAll(this.#dossierTemplateId));
diff --git a/apps/red-ui/src/app/modules/admin/screens/justifications/table-item/table-item.component.html b/apps/red-ui/src/app/modules/admin/screens/justifications/table-item/table-item.component.html
index fcc79db5a..e386a03e8 100644
--- a/apps/red-ui/src/app/modules/admin/screens/justifications/table-item/table-item.component.html
+++ b/apps/red-ui/src/app/modules/admin/screens/justifications/table-item/table-item.component.html
@@ -14,7 +14,7 @@
-
+
this.sendMail(),
type: IconButtonTypes.primary,
helpModeKey: 'license_information',
+ hide: !this.permissionsService.has(ROLES.license.readReport),
},
];
diff --git a/apps/red-ui/src/app/modules/admin/screens/license/license-select/license-select.component.html b/apps/red-ui/src/app/modules/admin/screens/license/license-select/license-select.component.html
index 254941a67..6694f8c1f 100644
--- a/apps/red-ui/src/app/modules/admin/screens/license/license-select/license-select.component.html
+++ b/apps/red-ui/src/app/modules/admin/screens/license/license-select/license-select.component.html
@@ -1,5 +1,11 @@
-
+
diff --git a/apps/red-ui/src/app/modules/admin/screens/license/license-select/license-select.component.ts b/apps/red-ui/src/app/modules/admin/screens/license/license-select/license-select.component.ts
index ecb78ad6b..bec041580 100644
--- a/apps/red-ui/src/app/modules/admin/screens/license/license-select/license-select.component.ts
+++ b/apps/red-ui/src/app/modules/admin/screens/license/license-select/license-select.component.ts
@@ -3,6 +3,8 @@ import { LicenseService } from '@services/license.service';
import { ILicense } from '@red/domain';
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
import { map, tap } from 'rxjs/operators';
+import { IqserPermissionsService } from '@iqser/common-ui';
+import { ROLES } from '@users/roles';
const translations = {
active: _('license-info-screen.status.active'),
@@ -24,8 +26,9 @@ export class LicenseSelectComponent {
}
}),
);
+ readonly isReadonly$ = this._permissionsService.has$(ROLES.license.edit).pipe(map(has => !has));
- constructor(readonly licenseService: LicenseService) {}
+ constructor(readonly licenseService: LicenseService, private readonly _permissionsService: IqserPermissionsService) {}
getStatus(id) {
return id === this.licenseService.activeLicenseId ? translations.active : translations.inactive;
diff --git a/apps/red-ui/src/app/modules/admin/screens/reports/reports-screen/reports-screen.component.html b/apps/red-ui/src/app/modules/admin/screens/reports/reports-screen/reports-screen.component.html
index b91496dea..3ca03ab33 100644
--- a/apps/red-ui/src/app/modules/admin/screens/reports/reports-screen/reports-screen.component.html
+++ b/apps/red-ui/src/app/modules/admin/screens/reports/reports-screen/reports-screen.component.html
@@ -23,16 +23,16 @@
@@ -43,11 +43,17 @@
-
+
([]);
availableTemplates$ = new BehaviorSubject([]);
- readonly #dossierTemplateId: string = getParam(DOSSIER_TEMPLATE_ID);
-
+ readonly currentUser = getCurrentUser();
+ readonly roles = ROLES;
+ readonly #dossierTemplateId = getParam(DOSSIER_TEMPLATE_ID);
@ViewChild('fileInput') private _fileInput: ElementRef;
constructor(
diff --git a/apps/red-ui/src/app/modules/admin/screens/reports/reports.module.ts b/apps/red-ui/src/app/modules/admin/screens/reports/reports.module.ts
index 3d3b8a97a..6be448070 100644
--- a/apps/red-ui/src/app/modules/admin/screens/reports/reports.module.ts
+++ b/apps/red-ui/src/app/modules/admin/screens/reports/reports.module.ts
@@ -4,7 +4,7 @@ import { RouterModule } from '@angular/router';
import { SharedModule } from '@shared/shared.module';
import { ReportsScreenComponent } from './reports-screen/reports-screen.component';
import { TranslateModule } from '@ngx-translate/core';
-import { IqserButtonsModule, IqserHelpModeModule, IqserScrollbarModule } from '@iqser/common-ui';
+import { IqserButtonsModule, IqserHelpModeModule, IqserPermissionsModule, IqserScrollbarModule } from '@iqser/common-ui';
const routes = [{ path: '', component: ReportsScreenComponent }];
@@ -18,6 +18,7 @@ const routes = [{ path: '', component: ReportsScreenComponent }];
IqserButtonsModule,
IqserScrollbarModule,
IqserHelpModeModule,
+ IqserPermissionsModule,
],
})
export class ReportsModule {}
diff --git a/apps/red-ui/src/app/modules/admin/screens/watermark/watermark-screen/watermark-screen.component.html b/apps/red-ui/src/app/modules/admin/screens/watermark/watermark-screen/watermark-screen.component.html
index 703c33672..8bc3c616d 100644
--- a/apps/red-ui/src/app/modules/admin/screens/watermark/watermark-screen/watermark-screen.component.html
+++ b/apps/red-ui/src/app/modules/admin/screens/watermark/watermark-screen/watermark-screen.component.html
@@ -1,6 +1,6 @@
-
+
= {
text: 'Watermark',
@@ -32,9 +42,10 @@ export const DEFAULT_WATERMARK: Partial = {
})
export class WatermarkScreenComponent {
readonly iconButtonTypes = IconButtonTypes;
- readonly form: UntypedFormGroup = this._getForm();
+ readonly currentUser = getCurrentUser();
+ readonly form = this._getForm();
readonly watermark$: Observable>;
- readonly #dossierTemplateId: string = getParam(DOSSIER_TEMPLATE_ID);
+ readonly #dossierTemplateId = getParam(DOSSIER_TEMPLATE_ID);
readonly #watermarkId = Number(getParam(WATERMARK_ID));
private _instance: WebViewerInstance;
private _watermark: Partial = {};
@@ -45,7 +56,7 @@ export class WatermarkScreenComponent {
private readonly _http: HttpClient,
private readonly _toaster: Toaster,
private readonly _formBuilder: UntypedFormBuilder,
- readonly permissionsService: PermissionsService,
+ readonly permissionsService: IqserPermissionsService,
private readonly _loadingService: LoadingService,
private readonly _licenseService: LicenseService,
@Inject(BASE_HREF_FN) private readonly _convertPath: BaseHrefFn,
@@ -210,7 +221,7 @@ export class WatermarkScreenComponent {
orientation: [null],
});
- if (!this.permissionsService.isAdmin()) {
+ if (!this.currentUser.isAdmin || !this.permissionsService.has(ROLES.watermarks.write)) {
form.disable();
}
diff --git a/apps/red-ui/src/app/modules/admin/screens/watermark/watermark.module.ts b/apps/red-ui/src/app/modules/admin/screens/watermark/watermark.module.ts
index 2f6dd99b0..b33918c7f 100644
--- a/apps/red-ui/src/app/modules/admin/screens/watermark/watermark.module.ts
+++ b/apps/red-ui/src/app/modules/admin/screens/watermark/watermark.module.ts
@@ -10,6 +10,7 @@ import {
IqserButtonsModule,
IqserHelpModeModule,
IqserListingModule,
+ IqserPermissionsModule,
IqserScrollbarModule,
IqserUsersModule,
} from '@iqser/common-ui';
@@ -57,6 +58,7 @@ const routes = [
IqserListingModule,
IqserScrollbarModule,
IqserHelpModeModule,
+ IqserPermissionsModule,
],
})
export class WatermarkModule {}
diff --git a/apps/red-ui/src/app/modules/admin/screens/watermark/watermarks-listing/watermarks-listing-screen.component.html b/apps/red-ui/src/app/modules/admin/screens/watermark/watermarks-listing/watermarks-listing-screen.component.html
index f8f384229..cdaadddd8 100644
--- a/apps/red-ui/src/app/modules/admin/screens/watermark/watermarks-listing/watermarks-listing-screen.component.html
+++ b/apps/red-ui/src/app/modules/admin/screens/watermark/watermarks-listing/watermarks-listing-screen.component.html
@@ -12,11 +12,11 @@
@@ -32,7 +32,7 @@
@@ -66,7 +66,7 @@
{
readonly iconButtonTypes = IconButtonTypes;
readonly circleButtonTypes = CircleButtonTypes;
- readonly currentUser = getCurrentUser();
+ readonly currentUser = getCurrentUser();
+ readonly roles = ROLES;
readonly tableColumnConfigs: TableColumnConfig[] = [
{ label: _('watermarks-listing.table-col-names.name'), sortByKey: 'searchKey', width: '2fr' },
{ label: _('watermarks-listing.table-col-names.status'), sortByKey: 'enabled', class: 'flex-center' },
@@ -36,8 +38,8 @@ export class WatermarksListingScreenComponent extends ListingComponent