remove duplicated methods
This commit is contained in:
parent
49f737b19e
commit
b7208a085d
@ -1,7 +1,7 @@
|
||||
<div class="red-top-bar">
|
||||
<div class="top-bar-row">
|
||||
<div *ngIf="!permissionsService.isUser()" class="menu-placeholder"></div>
|
||||
<div *ngIf="permissionsService.isUser()" class="menu visible-lt-lg">
|
||||
<div *ngIf="!currentUser.isUser" class="menu-placeholder"></div>
|
||||
<div *ngIf="currentUser.isUser" class="menu visible-lt-lg">
|
||||
<button [matMenuTriggerFor]="menuNav" mat-flat-button>
|
||||
<mat-icon svgIcon="red:menu"></mat-icon>
|
||||
</button>
|
||||
@ -23,20 +23,19 @@
|
||||
</button>
|
||||
</mat-menu>
|
||||
</div>
|
||||
<div *ngIf="permissionsService.isUser()" class="menu flex-2 visible-lg breadcrumbs-container">
|
||||
<a
|
||||
*ngIf="dossiersView"
|
||||
[routerLinkActiveOptions]="{ exact: true }"
|
||||
class="breadcrumb"
|
||||
routerLink="/main/dossiers"
|
||||
routerLinkActive="active"
|
||||
translate="top-bar.navigation-items.dossiers"
|
||||
></a>
|
||||
<a *ngIf="!dossiersView" class="breadcrumb back" redactionNavigateLastDossiersScreen>
|
||||
<div *ngIf="currentUser.isUser" class="menu flex-2 visible-lg breadcrumbs-container">
|
||||
<a *ngIf="(isDossiersView$ | async) === false" class="breadcrumb back" redactionNavigateLastDossiersScreen>
|
||||
<mat-icon svgIcon="red:expand"></mat-icon>
|
||||
{{ 'top-bar.navigation-items.back' | translate }}
|
||||
</a>
|
||||
<ng-container *ngIf="dossiersView">
|
||||
<ng-container *ngIf="isDossiersView$ | async">
|
||||
<a
|
||||
[routerLinkActiveOptions]="{ exact: true }"
|
||||
class="breadcrumb"
|
||||
routerLink="/main/dossiers"
|
||||
routerLinkActive="active"
|
||||
translate="top-bar.navigation-items.dossiers"
|
||||
></a>
|
||||
<mat-icon *ngIf="appStateService.activeDossier" svgIcon="red:arrow-right"></mat-icon>
|
||||
<a
|
||||
*ngIf="appStateService.activeDossier"
|
||||
@ -68,7 +67,7 @@
|
||||
<div class="buttons">
|
||||
<iqser-circle-button
|
||||
(action)="openSpotlightSearch()"
|
||||
*ngIf="!isSearchScreen"
|
||||
*ngIf="(isSearchScreen$ | async) === false"
|
||||
[icon]="'red:search'"
|
||||
[tooltip]="'search.header-label' | translate"
|
||||
tooltipPosition="below"
|
||||
@ -76,7 +75,11 @@
|
||||
|
||||
<redaction-notifications *ngIf="userPreferenceService.areDevFeaturesEnabled"></redaction-notifications>
|
||||
</div>
|
||||
<redaction-user-button [matMenuTriggerFor]="userMenu" [showDot]="showPendingDownloadsDot" [user]="user"></redaction-user-button>
|
||||
<redaction-user-button
|
||||
[matMenuTriggerFor]="userMenu"
|
||||
[showDot]="fileDownloadService.hasPendingDownloads"
|
||||
[userId]="currentUser.id"
|
||||
></redaction-user-button>
|
||||
|
||||
<mat-menu #userMenu="matMenu" xPosition="before">
|
||||
<ng-container *ngFor="let item of userMenuItems; trackBy: trackByName">
|
||||
@ -85,7 +88,7 @@
|
||||
</button>
|
||||
</ng-container>
|
||||
|
||||
<button (click)="logout()" mat-menu-item>
|
||||
<button (click)="userService.logout()" mat-menu-item>
|
||||
<mat-icon svgIcon="red:logout"></mat-icon>
|
||||
<span translate="top-bar.navigation-items.my-account.children.logout"> </span>
|
||||
</button>
|
||||
|
||||
@ -1,9 +1,8 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { UserService } from '@services/user.service';
|
||||
import { AppStateService } from '@state/app-state.service';
|
||||
import { PermissionsService } from '@services/permissions.service';
|
||||
import { UserPreferenceService } from '@services/user-preference.service';
|
||||
import { Router } from '@angular/router';
|
||||
import { NavigationStart, Router } from '@angular/router';
|
||||
import { Title } from '@angular/platform-browser';
|
||||
import { FileDownloadService } from '@upload-download/services/file-download.service';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
@ -12,19 +11,33 @@ import { SpotlightSearchComponent } from '@components/spotlight-search/spotlight
|
||||
import { SpotlightSearchAction } from '@components/spotlight-search/spotlight-search-action';
|
||||
import { SpotlightSearchDialogData } from '@components/spotlight-search/spotlight-search-dialog-data';
|
||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||
import { distinctUntilChanged, filter, map, startWith } from 'rxjs/operators';
|
||||
|
||||
interface MenuItem {
|
||||
name: string;
|
||||
routerLink?: string;
|
||||
show: boolean;
|
||||
action?: () => void;
|
||||
readonly name: string;
|
||||
readonly routerLink?: string;
|
||||
readonly show: boolean;
|
||||
readonly action?: () => void;
|
||||
}
|
||||
|
||||
const isNavigationStart = event => event instanceof NavigationStart;
|
||||
const isDossiersView = url => url.includes('/main/dossiers') && !url.includes('/search');
|
||||
const isSearchScreen = url => url.includes('/main/dossiers') && url.includes('/search');
|
||||
|
||||
@Component({
|
||||
templateUrl: './base-screen.component.html',
|
||||
styleUrls: ['./base-screen.component.scss']
|
||||
})
|
||||
export class BaseScreenComponent {
|
||||
private readonly _navigationStart$ = this._router.events.pipe(
|
||||
filter(isNavigationStart),
|
||||
map((event: NavigationStart) => event.url),
|
||||
startWith(this._router.url),
|
||||
distinctUntilChanged()
|
||||
);
|
||||
readonly currentUser = this.userService.currentUser;
|
||||
readonly isDossiersView$ = this._navigationStart$.pipe(map(isDossiersView));
|
||||
readonly isSearchScreen$ = this._navigationStart$.pipe(map(isSearchScreen));
|
||||
readonly userMenuItems: MenuItem[] = [
|
||||
{
|
||||
name: _('top-bar.navigation-items.my-account.children.my-profile'),
|
||||
@ -34,60 +47,31 @@ export class BaseScreenComponent {
|
||||
{
|
||||
name: _('top-bar.navigation-items.my-account.children.admin'),
|
||||
routerLink: '/main/admin',
|
||||
show: this.permissionsService.isManager() || this.permissionsService.isUserAdmin(),
|
||||
show: this.currentUser.isManager || this.currentUser.isUserAdmin,
|
||||
action: this.appStateService.reset
|
||||
},
|
||||
{
|
||||
name: _('top-bar.navigation-items.my-account.children.downloads'),
|
||||
routerLink: '/main/downloads',
|
||||
show: this.permissionsService.isUser()
|
||||
show: this.currentUser.isUser
|
||||
},
|
||||
{
|
||||
name: _('top-bar.navigation-items.my-account.children.trash'),
|
||||
routerLink: '/main/admin/trash',
|
||||
show: this.permissionsService.isManager() || this.permissionsService.isUserAdmin()
|
||||
show: this.currentUser.isManager || this.currentUser.isUserAdmin
|
||||
}
|
||||
];
|
||||
|
||||
showSearch = false;
|
||||
|
||||
constructor(
|
||||
readonly appStateService: AppStateService,
|
||||
readonly permissionsService: PermissionsService,
|
||||
readonly userService: UserService,
|
||||
readonly userPreferenceService: UserPreferenceService,
|
||||
readonly titleService: Title,
|
||||
readonly fileDownloadService: FileDownloadService,
|
||||
private readonly _router: Router,
|
||||
private readonly _userService: UserService,
|
||||
private readonly _translateService: TranslateService,
|
||||
private readonly _dialog: MatDialog
|
||||
) {
|
||||
_router.events.subscribe(() => {
|
||||
this._dossiersView = _router.url.includes('/main/dossiers') && !this.isSearchScreen;
|
||||
});
|
||||
}
|
||||
|
||||
private _dossiersView: boolean;
|
||||
|
||||
get dossiersView() {
|
||||
return this._dossiersView;
|
||||
}
|
||||
|
||||
get isSearchScreen() {
|
||||
return this._router.url.includes('/search');
|
||||
}
|
||||
|
||||
get user() {
|
||||
return this._userService.currentUser;
|
||||
}
|
||||
|
||||
get showPendingDownloadsDot() {
|
||||
return this.fileDownloadService.hasPendingDownloads;
|
||||
}
|
||||
|
||||
get languages(): string[] {
|
||||
return this._translateService.langs;
|
||||
}
|
||||
) {}
|
||||
|
||||
openSpotlightSearch() {
|
||||
const spotlightSearchActions: SpotlightSearchAction[] = [
|
||||
@ -95,12 +79,12 @@ export class BaseScreenComponent {
|
||||
text: this._translateService.instant('search.this-dossier'),
|
||||
icon: 'red:enter',
|
||||
hide: !this.appStateService.activeDossier,
|
||||
action: query => this._searchThisDossier(query)
|
||||
action: query => this._search(query, this.appStateService.activeDossier.dossierId)
|
||||
},
|
||||
{
|
||||
text: this._translateService.instant('search.entire-platform'),
|
||||
icon: 'red:enter',
|
||||
action: query => this._searchEntirePlatform(query)
|
||||
action: query => this._search(query)
|
||||
}
|
||||
];
|
||||
|
||||
@ -112,23 +96,9 @@ export class BaseScreenComponent {
|
||||
});
|
||||
}
|
||||
|
||||
private _searchThisDossier(query: string) {
|
||||
this._router
|
||||
.navigate(['main/dossiers/search'], {
|
||||
queryParams: {
|
||||
query: query,
|
||||
dossierId: this.appStateService.activeDossier.dossierId
|
||||
}
|
||||
})
|
||||
.then();
|
||||
}
|
||||
|
||||
private _searchEntirePlatform(query: string) {
|
||||
this._router.navigate(['main/dossiers/search'], { queryParams: { query: query } }).then();
|
||||
}
|
||||
|
||||
logout() {
|
||||
this._userService.logout();
|
||||
private _search(query: string, dossierId?: string) {
|
||||
const queryParams = { query, dossierId };
|
||||
this._router.navigate(['main/dossiers/search'], { queryParams }).then();
|
||||
}
|
||||
|
||||
trackByName(index: number, item: MenuItem) {
|
||||
|
||||
@ -1,12 +1,7 @@
|
||||
<redaction-side-nav [title]="translations[type] | translate">
|
||||
<ng-container *ngFor="let item of items[type]">
|
||||
<div
|
||||
*ngIf="
|
||||
(!item.onlyAdmin || permissionsService.isAdmin()) &&
|
||||
(!item.onlyDevMode || userPreferenceService.areDevFeaturesEnabled) &&
|
||||
(!item.userManagerOnly || permissionsService.canManageUsers()) &&
|
||||
(!item.onlyManager || permissionsService.isManager())
|
||||
"
|
||||
*ngIf="!item.hideIf"
|
||||
[routerLinkActiveOptions]="{ exact: false }"
|
||||
[routerLink]="prefix + item.screen"
|
||||
class="item"
|
||||
|
||||
@ -1,12 +1,18 @@
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { PermissionsService } from '@services/permissions.service';
|
||||
import { UserPreferenceService } from '@services/user-preference.service';
|
||||
import { AppStateService } from '@state/app-state.service';
|
||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||
import { adminSideNavTranslations } from '../translations/admin-side-nav-translations';
|
||||
import { UserService } from '@services/user.service';
|
||||
|
||||
type Type = 'settings' | 'dossierTemplates';
|
||||
|
||||
interface NavItem {
|
||||
readonly label: string;
|
||||
readonly screen: string;
|
||||
readonly hideIf?: boolean;
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'redaction-admin-side-nav',
|
||||
templateUrl: './admin-side-nav.component.html',
|
||||
@ -14,29 +20,42 @@ type Type = 'settings' | 'dossierTemplates';
|
||||
})
|
||||
export class AdminSideNavComponent {
|
||||
@Input() type: Type;
|
||||
translations = adminSideNavTranslations;
|
||||
readonly translations = adminSideNavTranslations;
|
||||
readonly currentUser = this._userService.currentUser;
|
||||
readonly prefix = this._appStateService.activeDictionaryType ? '../../' : '../';
|
||||
|
||||
items: {
|
||||
[key in Type]: {
|
||||
screen: string;
|
||||
onlyDevMode?: boolean;
|
||||
onlyAdmin?: boolean;
|
||||
onlyManager?: boolean;
|
||||
userManagerOnly?: boolean;
|
||||
label: string;
|
||||
}[];
|
||||
} = {
|
||||
readonly items: { readonly [key in Type]: NavItem[] } = {
|
||||
settings: [
|
||||
{ screen: 'dossier-templates', label: _('dossier-templates'), onlyManager: true },
|
||||
{ screen: 'digital-signature', label: _('digital-signature'), onlyAdmin: true },
|
||||
{ screen: 'license-info', label: _('license-information'), onlyAdmin: true },
|
||||
{ screen: 'audit', label: _('audit'), onlyAdmin: true },
|
||||
{ screen: 'users', label: _('user-management'), userManagerOnly: true },
|
||||
{ screen: 'general-config', label: _('configurations'), onlyAdmin: true }
|
||||
{
|
||||
screen: 'dossier-templates',
|
||||
label: _('dossier-templates'),
|
||||
hideIf: !this.currentUser.isManager
|
||||
},
|
||||
{
|
||||
screen: 'digital-signature',
|
||||
label: _('digital-signature'),
|
||||
hideIf: !this.currentUser.isAdmin
|
||||
},
|
||||
{
|
||||
screen: 'license-info',
|
||||
label: _('license-information'),
|
||||
hideIf: !this.currentUser.isAdmin
|
||||
},
|
||||
{ screen: 'audit', label: _('audit'), hideIf: !this.currentUser.isAdmin },
|
||||
{ screen: 'users', label: _('user-management'), hideIf: !this.currentUser.isUserAdmin },
|
||||
{
|
||||
screen: 'general-config',
|
||||
label: _('configurations'),
|
||||
hideIf: !this.currentUser.isAdmin
|
||||
}
|
||||
],
|
||||
dossierTemplates: [
|
||||
{ screen: 'dictionaries', label: _('dictionaries') },
|
||||
{ screen: 'rules', onlyDevMode: true, label: _('rule-editor') },
|
||||
{
|
||||
screen: 'rules',
|
||||
label: _('rule-editor'),
|
||||
hideIf: !this.userPreferenceService.areDevFeaturesEnabled
|
||||
},
|
||||
{ screen: 'default-colors', label: _('default-colors') },
|
||||
{ screen: 'watermark', label: _('watermark') },
|
||||
{ screen: 'file-attributes', label: _('file-attributes') },
|
||||
@ -46,16 +65,8 @@ export class AdminSideNavComponent {
|
||||
};
|
||||
|
||||
constructor(
|
||||
private readonly _userService: UserService,
|
||||
private readonly _appStateService: AppStateService,
|
||||
readonly userPreferenceService: UserPreferenceService,
|
||||
readonly permissionsService: PermissionsService
|
||||
readonly userPreferenceService: UserPreferenceService
|
||||
) {}
|
||||
|
||||
get prefix() {
|
||||
if (this._appStateService.activeDictionaryType) {
|
||||
return '../../';
|
||||
}
|
||||
|
||||
return '../';
|
||||
}
|
||||
}
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
|
||||
<div class="actions">
|
||||
<iqser-circle-button
|
||||
*ngIf="permissionsService.isUser()"
|
||||
*ngIf="currentUser.isUser"
|
||||
[tooltip]="'common.close' | translate"
|
||||
class="ml-6"
|
||||
icon="red:close"
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
import { Component, OnDestroy } from '@angular/core';
|
||||
import { PermissionsService } from '@services/permissions.service';
|
||||
import { FormBuilder, FormGroup } from '@angular/forms';
|
||||
import { AuditControllerService, AuditResponse, AuditSearchRequest } from '@redaction/red-ui-http';
|
||||
import { Moment } from 'moment';
|
||||
@ -8,6 +7,7 @@ import { LoadingService } from '@services/loading.service';
|
||||
import { AutoUnsubscribeComponent } from '@iqser/common-ui';
|
||||
import { auditCategoriesTranslations } from '../../translations/audit-categories-translations';
|
||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||
import { UserService } from '@services/user.service';
|
||||
|
||||
const PAGE_SIZE = 50;
|
||||
|
||||
@ -19,7 +19,8 @@ const PAGE_SIZE = 50;
|
||||
export class AuditScreenComponent extends AutoUnsubscribeComponent implements OnDestroy {
|
||||
readonly ALL_CATEGORIES = 'allCategories';
|
||||
readonly ALL_USERS = _('audit-screen.all-users');
|
||||
translations = auditCategoriesTranslations;
|
||||
readonly translations = auditCategoriesTranslations;
|
||||
readonly currentUser = this._userService.currentUser;
|
||||
|
||||
filterForm: FormGroup;
|
||||
categories: string[] = [];
|
||||
@ -30,10 +31,10 @@ export class AuditScreenComponent extends AutoUnsubscribeComponent implements On
|
||||
private _previousTo: Moment;
|
||||
|
||||
constructor(
|
||||
readonly permissionsService: PermissionsService,
|
||||
private readonly _userService: UserService,
|
||||
private readonly _formBuilder: FormBuilder,
|
||||
private readonly _auditControllerService: AuditControllerService,
|
||||
private readonly _loadingService: LoadingService
|
||||
private readonly _loadingService: LoadingService,
|
||||
private readonly _auditControllerService: AuditControllerService
|
||||
) {
|
||||
super();
|
||||
this.filterForm = this._formBuilder.group({
|
||||
|
||||
@ -4,10 +4,7 @@
|
||||
<redaction-admin-side-nav type="settings"></redaction-admin-side-nav>
|
||||
|
||||
<div>
|
||||
<redaction-page-header
|
||||
[pageLabel]="'digital-signature' | translate"
|
||||
[showCloseButton]="permissionsService.isUser()"
|
||||
></redaction-page-header>
|
||||
<redaction-page-header [pageLabel]="'digital-signature' | translate" [showCloseButton]="currentUser.isUser"></redaction-page-header>
|
||||
|
||||
<div class="red-content-inner">
|
||||
<div class="content-container">
|
||||
|
||||
@ -2,12 +2,11 @@ import { Component, OnDestroy } from '@angular/core';
|
||||
import { DigitalSignature, DigitalSignatureControllerService } from '@redaction/red-ui-http';
|
||||
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
||||
import { Toaster } from '@services/toaster.service';
|
||||
import { PermissionsService } from '@services/permissions.service';
|
||||
import { lastIndexOfEnd } from '@utils/functions';
|
||||
import { AutoUnsubscribeComponent } from '@iqser/common-ui';
|
||||
import { AutoUnsubscribeComponent, IconButtonTypes } from '@iqser/common-ui';
|
||||
import { LoadingService } from '@services/loading.service';
|
||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||
import { IconButtonTypes } from '@iqser/common-ui';
|
||||
import { UserService } from '@services/user.service';
|
||||
|
||||
@Component({
|
||||
selector: 'redaction-digital-signature-screen',
|
||||
@ -16,6 +15,7 @@ import { IconButtonTypes } from '@iqser/common-ui';
|
||||
})
|
||||
export class DigitalSignatureScreenComponent extends AutoUnsubscribeComponent implements OnDestroy {
|
||||
readonly iconButtonTypes = IconButtonTypes;
|
||||
readonly currentUser = this._userService.currentUser;
|
||||
|
||||
digitalSignature: DigitalSignature;
|
||||
digitalSignatureForm: FormGroup;
|
||||
@ -23,11 +23,11 @@ export class DigitalSignatureScreenComponent extends AutoUnsubscribeComponent im
|
||||
digitalSignatureExists = false;
|
||||
|
||||
constructor(
|
||||
private readonly _digitalSignatureControllerService: DigitalSignatureControllerService,
|
||||
private readonly _toaster: Toaster,
|
||||
private readonly _formBuilder: FormBuilder,
|
||||
private readonly _userService: UserService,
|
||||
private readonly _loadingService: LoadingService,
|
||||
readonly permissionsService: PermissionsService
|
||||
private readonly _digitalSignatureControllerService: DigitalSignatureControllerService
|
||||
) {
|
||||
super();
|
||||
this.loadDigitalSignatureAndInitializeForm();
|
||||
|
||||
@ -4,10 +4,7 @@
|
||||
<redaction-admin-side-nav type="settings"></redaction-admin-side-nav>
|
||||
|
||||
<div>
|
||||
<redaction-page-header
|
||||
[pageLabel]="'dossier-templates' | translate"
|
||||
[showCloseButton]="permissionsService.isUser()"
|
||||
></redaction-page-header>
|
||||
<redaction-page-header [pageLabel]="'dossier-templates' | translate" [showCloseButton]="currentUser.isUser"></redaction-page-header>
|
||||
|
||||
<div class="red-content-inner">
|
||||
<div class="content-container">
|
||||
@ -27,7 +24,7 @@
|
||||
|
||||
<iqser-circle-button
|
||||
(action)="openDeleteTemplatesDialog($event)"
|
||||
*ngIf="canBulkDelete$(permissionsService.isAdmin()) | async"
|
||||
*ngIf="canBulkDelete$(currentUser.isAdmin) | async"
|
||||
[tooltip]="'dossier-templates-listing.bulk.delete' | translate"
|
||||
icon="red:trash"
|
||||
[type]="circleButtonTypes.dark"
|
||||
@ -42,7 +39,7 @@
|
||||
|
||||
<iqser-icon-button
|
||||
(action)="openAddDossierTemplateDialog()"
|
||||
*ngIf="permissionsService.isAdmin() && userPreferenceService.areDevFeaturesEnabled"
|
||||
*ngIf="currentUser.isAdmin && userPreferenceService.areDevFeaturesEnabled"
|
||||
[label]="'dossier-templates-listing.add-new' | translate"
|
||||
icon="red:plus"
|
||||
[type]="iconButtonTypes.primary"
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
import { ChangeDetectionStrategy, Component, Injector, OnInit } from '@angular/core';
|
||||
import { AppStateService } from '@state/app-state.service';
|
||||
import { PermissionsService } from '@services/permissions.service';
|
||||
import { UserPreferenceService } from '@services/user-preference.service';
|
||||
import { AdminDialogService } from '../../services/admin-dialog.service';
|
||||
import { DossierTemplateModelWrapper } from '@models/file/dossier-template-model.wrapper';
|
||||
@ -8,6 +7,7 @@ import { LoadingService } from '@services/loading.service';
|
||||
import { DossierTemplateControllerService } from '@redaction/red-ui-http';
|
||||
import { CircleButtonTypes, IconButtonTypes } from '@iqser/common-ui';
|
||||
import { BaseListingComponent, DefaultListingServices } from '@shared/base/base-listing.component';
|
||||
import { UserService } from '@services/user.service';
|
||||
|
||||
@Component({
|
||||
templateUrl: './dossier-templates-listing-screen.component.html',
|
||||
@ -16,18 +16,19 @@ import { BaseListingComponent, DefaultListingServices } from '@shared/base/base-
|
||||
providers: [...DefaultListingServices]
|
||||
})
|
||||
export class DossierTemplatesListingScreenComponent extends BaseListingComponent<DossierTemplateModelWrapper> implements OnInit {
|
||||
protected readonly _primaryKey = 'name';
|
||||
readonly iconButtonTypes = IconButtonTypes;
|
||||
readonly circleButtonTypes = CircleButtonTypes;
|
||||
protected readonly _primaryKey = 'name';
|
||||
readonly currentUser = this._userService.currentUser;
|
||||
|
||||
constructor(
|
||||
private readonly _dialogService: AdminDialogService,
|
||||
private readonly _appStateService: AppStateService,
|
||||
private readonly _loadingService: LoadingService,
|
||||
private readonly _dossierTemplateControllerService: DossierTemplateControllerService,
|
||||
protected readonly _injector: Injector,
|
||||
readonly permissionsService: PermissionsService,
|
||||
readonly userPreferenceService: UserPreferenceService
|
||||
private readonly _userService: UserService,
|
||||
private readonly _loadingService: LoadingService,
|
||||
private readonly _appStateService: AppStateService,
|
||||
private readonly _dialogService: AdminDialogService,
|
||||
readonly userPreferenceService: UserPreferenceService,
|
||||
private readonly _dossierTemplateControllerService: DossierTemplateControllerService
|
||||
) {
|
||||
super(_injector);
|
||||
}
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
|
||||
<div class="actions">
|
||||
<iqser-circle-button
|
||||
*ngIf="permissionsService.isUser()"
|
||||
*ngIf="currentUser.isUser"
|
||||
class="ml-6"
|
||||
icon="red:close"
|
||||
redactionNavigateLastDossiersScreen
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
import { Component, OnDestroy, OnInit } from '@angular/core';
|
||||
import { PermissionsService } from '@services/permissions.service';
|
||||
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
||||
import { AdminDialogService } from '../../services/admin-dialog.service';
|
||||
import {
|
||||
@ -9,11 +8,11 @@ import {
|
||||
SMTPConfigurationModel
|
||||
} from '@redaction/red-ui-http';
|
||||
import { AppConfigService } from '@app-config/app-config.service';
|
||||
import { AutoUnsubscribeComponent } from '@iqser/common-ui';
|
||||
import { AutoUnsubscribeComponent, IconButtonTypes } from '@iqser/common-ui';
|
||||
import { Toaster } from '@services/toaster.service';
|
||||
import { LoadingService } from '@services/loading.service';
|
||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||
import { IconButtonTypes } from '@iqser/common-ui';
|
||||
import { UserService } from '@services/user.service';
|
||||
|
||||
@Component({
|
||||
selector: 'redaction-general-config-screen',
|
||||
@ -22,6 +21,8 @@ import { IconButtonTypes } from '@iqser/common-ui';
|
||||
})
|
||||
export class GeneralConfigScreenComponent extends AutoUnsubscribeComponent implements OnInit, OnDestroy {
|
||||
readonly iconButtonTypes = IconButtonTypes;
|
||||
readonly currentUser = this._userService.currentUser;
|
||||
|
||||
readonly configForm: FormGroup;
|
||||
readonly smtpForm: FormGroup;
|
||||
|
||||
@ -29,14 +30,14 @@ export class GeneralConfigScreenComponent extends AutoUnsubscribeComponent imple
|
||||
private _initialSMTPConfiguration: SMTPConfigurationModel;
|
||||
|
||||
constructor(
|
||||
readonly permissionsService: PermissionsService,
|
||||
private readonly _smtpConfigService: SmtpConfigurationControllerService,
|
||||
private readonly _appConfigService: AppConfigService,
|
||||
private readonly _formBuilder: FormBuilder,
|
||||
private readonly _toaster: Toaster,
|
||||
private readonly _userService: UserService,
|
||||
private readonly _formBuilder: FormBuilder,
|
||||
private readonly _loadingService: LoadingService,
|
||||
private readonly _dialogService: AdminDialogService,
|
||||
private readonly _generalSettingsControllerService: GeneralSettingsControllerService,
|
||||
private readonly _loadingService: LoadingService
|
||||
private readonly _appConfigService: AppConfigService,
|
||||
private readonly _smtpConfigService: SmtpConfigurationControllerService,
|
||||
private readonly _generalSettingsControllerService: GeneralSettingsControllerService
|
||||
) {
|
||||
super();
|
||||
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
<redaction-page-header
|
||||
[buttonConfigs]="buttonConfigs"
|
||||
[pageLabel]="'license-information' | translate"
|
||||
[showCloseButton]="permissionsService.isUser()"
|
||||
[showCloseButton]="currentUser.isUser"
|
||||
></redaction-page-header>
|
||||
|
||||
<div class="red-content-inner">
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { PermissionsService } from '@services/permissions.service';
|
||||
import { LicenseReport, LicenseReportControllerService } from '@redaction/red-ui-http';
|
||||
import { AppConfigService } from '@app-config/app-config.service';
|
||||
import * as moment from 'moment';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { LoadingService } from '../../../../services/loading.service';
|
||||
import { ButtonConfig } from '../../../shared/components/page-header/models/button-config.model';
|
||||
import { LoadingService } from '@services/loading.service';
|
||||
import { ButtonConfig } from '@shared/components/page-header/models/button-config.model';
|
||||
import { IconButtonTypes } from '@iqser/common-ui';
|
||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||
import { UserService } from '@services/user.service';
|
||||
|
||||
@Component({
|
||||
selector: 'redaction-license-information-screen',
|
||||
@ -15,6 +15,15 @@ import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||
styleUrls: ['./license-information-screen.component.scss']
|
||||
})
|
||||
export class LicenseInformationScreenComponent implements OnInit {
|
||||
readonly currentUser = this._userService.currentUser;
|
||||
readonly buttonConfigs: ButtonConfig[] = [
|
||||
{
|
||||
label: _('license-info-screen.email-report'),
|
||||
action: () => this.sendMail(),
|
||||
type: IconButtonTypes.primary
|
||||
}
|
||||
];
|
||||
|
||||
currentInfo: LicenseReport = {};
|
||||
totalInfo: LicenseReport = {};
|
||||
unlicensedInfo: LicenseReport = {};
|
||||
@ -34,20 +43,13 @@ export class LicenseInformationScreenComponent implements OnInit {
|
||||
group: 'Ordinal',
|
||||
domain: ['#0389ec']
|
||||
};
|
||||
buttonConfigs: ButtonConfig[] = [
|
||||
{
|
||||
label: _('license-info-screen.email-report'),
|
||||
action: () => this.sendMail(),
|
||||
type: IconButtonTypes.primary
|
||||
}
|
||||
];
|
||||
|
||||
constructor(
|
||||
readonly permissionsService: PermissionsService,
|
||||
private readonly _userService: UserService,
|
||||
readonly appConfigService: AppConfigService,
|
||||
private readonly _licenseReportController: LicenseReportControllerService,
|
||||
private readonly _loadingService: LoadingService,
|
||||
private readonly _translateService: TranslateService,
|
||||
private readonly _loadingService: LoadingService
|
||||
private readonly _licenseReportController: LicenseReportControllerService
|
||||
) {
|
||||
_loadingService.start();
|
||||
}
|
||||
|
||||
@ -15,13 +15,13 @@
|
||||
></redaction-input-with-action>
|
||||
<iqser-icon-button
|
||||
(action)="openAddEditUserDialog($event)"
|
||||
*ngIf="permissionsService.isUserAdmin()"
|
||||
*ngIf="currentUser.isUserAdmin"
|
||||
[label]="'user-listing.add-new' | translate"
|
||||
icon="red:plus"
|
||||
[type]="iconButtonTypes.primary"
|
||||
></iqser-icon-button>
|
||||
<iqser-circle-button
|
||||
*ngIf="permissionsService.isUser()"
|
||||
*ngIf="currentUser.isUser"
|
||||
[tooltip]="'common.close' | translate"
|
||||
class="ml-6"
|
||||
icon="red:close"
|
||||
@ -93,7 +93,7 @@
|
||||
<div class="center">
|
||||
<mat-slide-toggle
|
||||
(toggleChange)="toggleActive(user)"
|
||||
[checked]="userService.isActive(user)"
|
||||
[checked]="user.isActive"
|
||||
color="primary"
|
||||
></mat-slide-toggle>
|
||||
</div>
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
import { Component, Injector, OnInit, QueryList, ViewChildren } from '@angular/core';
|
||||
import { PermissionsService } from '@services/permissions.service';
|
||||
import { UserService, UserWrapper } from '@services/user.service';
|
||||
import { UserControllerService } from '@redaction/red-ui-http';
|
||||
import { AdminDialogService } from '../../services/admin-dialog.service';
|
||||
@ -20,32 +19,33 @@ import { rolesTranslations } from '../../../../translations/roles-translations';
|
||||
providers: [...DefaultListingServices]
|
||||
})
|
||||
export class UserListingScreenComponent extends BaseListingComponent<UserWrapper> implements OnInit {
|
||||
protected readonly _primaryKey = 'id';
|
||||
readonly translations = rolesTranslations;
|
||||
readonly iconButtonTypes = IconButtonTypes;
|
||||
readonly circleButtonTypes = CircleButtonTypes;
|
||||
readonly currentUser = this.userService.currentUser;
|
||||
readonly canDeleteSelected$ = this._canDeleteSelected$;
|
||||
|
||||
collapsedDetails = false;
|
||||
chartData: DoughnutChartConfig[] = [];
|
||||
readonly translations = rolesTranslations;
|
||||
protected readonly _primaryKey = 'id';
|
||||
@ViewChildren(InitialsAvatarComponent)
|
||||
private readonly _avatars: QueryList<InitialsAvatarComponent>;
|
||||
|
||||
constructor(
|
||||
readonly permissionsService: PermissionsService,
|
||||
readonly userService: UserService,
|
||||
private readonly _translateService: TranslateService,
|
||||
private readonly _dialogService: AdminDialogService,
|
||||
private readonly _userControllerService: UserControllerService,
|
||||
private readonly _translateChartService: TranslateChartService,
|
||||
protected readonly _injector: Injector,
|
||||
private readonly _loadingService: LoadingService,
|
||||
protected readonly _injector: Injector
|
||||
private readonly _dialogService: AdminDialogService,
|
||||
private readonly _translateService: TranslateService,
|
||||
private readonly _userControllerService: UserControllerService,
|
||||
private readonly _translateChartService: TranslateChartService
|
||||
) {
|
||||
super(_injector);
|
||||
}
|
||||
|
||||
get _canDeleteSelected$(): Observable<boolean> {
|
||||
const entities$ = this.screenStateService.selectedEntities$;
|
||||
return entities$.pipe(map(all => all.indexOf(this.userService.currentUser) === -1));
|
||||
return entities$.pipe(map(all => all.indexOf(this.currentUser) === -1));
|
||||
}
|
||||
|
||||
async ngOnInit() {
|
||||
@ -75,7 +75,7 @@ export class UserListingScreenComponent extends BaseListingComponent<UserWrapper
|
||||
|
||||
async toggleActive(user: UserWrapper) {
|
||||
this._loadingService.start();
|
||||
user.roles = this.userService.isActive(user) ? [] : ['RED_USER'];
|
||||
user.roles = user.isActive ? [] : ['RED_USER'];
|
||||
await this._userControllerService.updateProfile(user, user.id).toPromise();
|
||||
await this._loadData();
|
||||
this._avatars.find(item => item.userId === user.id).detectChanges();
|
||||
@ -96,7 +96,7 @@ export class UserListingScreenComponent extends BaseListingComponent<UserWrapper
|
||||
this.chartData = this._translateChartService.translateRoles(
|
||||
[
|
||||
{
|
||||
value: this.allEntities.filter(user => !this.userService.isActive(user)).length,
|
||||
value: this.allEntities.filter(user => !user.isActive).length,
|
||||
color: 'INACTIVE',
|
||||
label: 'INACTIVE'
|
||||
},
|
||||
|
||||
@ -36,7 +36,7 @@ export class RedRoleGuard implements CanActivate {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this._userService.isUser() && state.url.startsWith('/main/dossiers')) {
|
||||
if (!this._userService.currentUser.isUser && state.url.startsWith('/main/dossiers')) {
|
||||
this._router.navigate(['/main/admin']);
|
||||
obs.next(false);
|
||||
obs.complete();
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
|
||||
<iqser-circle-button
|
||||
(action)="editingOwner = true"
|
||||
*ngIf="permissionsService.isManager()"
|
||||
*ngIf="currentUser.isManager"
|
||||
[tooltip]="'dossier-details.edit-owner' | translate"
|
||||
class="ml-14"
|
||||
icon="red:edit"
|
||||
|
||||
@ -2,7 +2,6 @@ import { ChangeDetectorRef, Component, EventEmitter, Input, OnInit, Output } fro
|
||||
import { AppStateService } from '@state/app-state.service';
|
||||
import { groupBy } from '@utils/functions';
|
||||
import { DoughnutChartConfig } from '@shared/components/simple-doughnut-chart/simple-doughnut-chart.component';
|
||||
import { PermissionsService } from '@services/permissions.service';
|
||||
import { TranslateChartService } from '@services/translate-chart.service';
|
||||
import { StatusSorter } from '@utils/sorters/status-sorter';
|
||||
import { UserService, UserWrapper } from '@services/user.service';
|
||||
@ -29,11 +28,11 @@ export class DossierDetailsComponent implements OnInit {
|
||||
expandTooltip = _('dossier-details.expand');
|
||||
|
||||
readonly needsWorkFilters$ = this.filterService.getFilterModels$('needsWorkFilters');
|
||||
readonly currentUser = this._userService.currentUser;
|
||||
|
||||
constructor(
|
||||
readonly appStateService: AppStateService,
|
||||
readonly translateChartService: TranslateChartService,
|
||||
readonly permissionsService: PermissionsService,
|
||||
readonly filterService: FilterService,
|
||||
private readonly _changeDetectorRef: ChangeDetectorRef,
|
||||
private readonly _userService: UserService,
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
<redaction-status-bar [config]="getDossierStatusConfig(dossier)"></redaction-status-bar>
|
||||
<div [class.active]="actionMenuOpen" class="action-buttons">
|
||||
<div class="action-buttons">
|
||||
<iqser-circle-button
|
||||
(action)="openEditDossierDialog($event, dossier)"
|
||||
*ngIf="permissionsService.isManager()"
|
||||
*ngIf="currentUser.isManager"
|
||||
[tooltip]="'dossier-listing.edit.action' | translate"
|
||||
icon="red:edit"
|
||||
[type]="circleButtonTypes.dark"
|
||||
|
||||
@ -5,6 +5,7 @@ import { StatusSorter } from '@utils/sorters/status-sorter';
|
||||
import { AppStateService } from '@state/app-state.service';
|
||||
import { DossiersDialogService } from '../../services/dossiers-dialog.service';
|
||||
import { CircleButtonTypes } from '@iqser/common-ui';
|
||||
import { UserService } from '@services/user.service';
|
||||
|
||||
@Component({
|
||||
selector: 'redaction-dossier-listing-actions',
|
||||
@ -13,15 +14,16 @@ import { CircleButtonTypes } from '@iqser/common-ui';
|
||||
})
|
||||
export class DossierListingActionsComponent {
|
||||
readonly circleButtonTypes = CircleButtonTypes;
|
||||
readonly currentUser = this._userService.currentUser;
|
||||
|
||||
@Input() dossier: DossierWrapper;
|
||||
@Output() actionPerformed = new EventEmitter<DossierWrapper | undefined>();
|
||||
actionMenuOpen = false;
|
||||
|
||||
constructor(
|
||||
readonly permissionsService: PermissionsService,
|
||||
readonly appStateService: AppStateService,
|
||||
private readonly _dialogService: DossiersDialogService
|
||||
private readonly _dialogService: DossiersDialogService,
|
||||
private readonly _userService: UserService
|
||||
) {}
|
||||
|
||||
openEditDossierDialog($event: MouseEvent, dossierWrapper: DossierWrapper) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<div *ngIf="screen === 'dossier-overview'" [class.active]="actionMenuOpen" class="action-buttons">
|
||||
<div *ngIf="screen === 'dossier-overview'" class="action-buttons">
|
||||
<ng-container *ngTemplateOutlet="actions"></ng-container>
|
||||
<redaction-status-bar *ngIf="fileStatus?.isWorkable" [config]="statusBarConfig"></redaction-status-bar>
|
||||
</div>
|
||||
|
||||
@ -10,6 +10,7 @@ import { FileManagementControllerService } from '@redaction/red-ui-http';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||
import { CircleButtonTypes } from '@iqser/common-ui';
|
||||
import { UserService } from '@services/user.service';
|
||||
|
||||
@Component({
|
||||
selector: 'redaction-file-actions',
|
||||
@ -18,12 +19,12 @@ import { CircleButtonTypes } from '@iqser/common-ui';
|
||||
})
|
||||
export class FileActionsComponent implements OnInit {
|
||||
readonly circleButtonTypes = CircleButtonTypes;
|
||||
readonly currentUser = this._userService.currentUser;
|
||||
|
||||
@Input() fileStatus: FileStatusWrapper;
|
||||
@Input() activeDocumentInfo: boolean;
|
||||
@Input() activeExcludePages: boolean;
|
||||
@Output() actionPerformed = new EventEmitter<string>();
|
||||
actionMenuOpen: boolean;
|
||||
|
||||
screen: 'file-preview' | 'dossier-overview';
|
||||
|
||||
@ -34,7 +35,8 @@ export class FileActionsComponent implements OnInit {
|
||||
private readonly _fileActionService: FileActionService,
|
||||
private readonly _loadingService: LoadingService,
|
||||
private readonly _fileManagementControllerService: FileManagementControllerService,
|
||||
private readonly _translateService: TranslateService
|
||||
private readonly _translateService: TranslateService,
|
||||
private readonly _userService: UserService
|
||||
) {}
|
||||
|
||||
get statusBarConfig() {
|
||||
@ -50,7 +52,7 @@ export class FileActionsComponent implements OnInit {
|
||||
}
|
||||
|
||||
get toggleTooltip(): string {
|
||||
if (!this.permissionsService.isManager()) {
|
||||
if (!this.currentUser.isManager) {
|
||||
return _('file-preview.toggle-analysis.only-managers');
|
||||
}
|
||||
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
</div>
|
||||
<iqser-circle-button
|
||||
(action)="openAssignDossierMembersDialog.emit()"
|
||||
*ngIf="permissionsService.isManager() && canAdd"
|
||||
*ngIf="currentUser.isManager && canAdd"
|
||||
[class.large-spacing]="largeSpacing"
|
||||
[size]="32"
|
||||
[tooltip]="'dossier-details.assign-members' | translate"
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { Component, ElementRef, EventEmitter, Input, Output, ViewChild } from '@angular/core';
|
||||
import { PermissionsService } from '@services/permissions.service';
|
||||
import { CircleButtonTypes } from '@iqser/common-ui';
|
||||
import { UserService } from '@services/user.service';
|
||||
|
||||
@Component({
|
||||
selector: 'redaction-team-members',
|
||||
@ -9,6 +9,7 @@ import { CircleButtonTypes } from '@iqser/common-ui';
|
||||
})
|
||||
export class TeamMembersComponent {
|
||||
readonly circleButtonTypes = CircleButtonTypes;
|
||||
readonly currentUser = this._userService.currentUser;
|
||||
|
||||
@Input() memberIds: string[];
|
||||
@Input() perLine: number;
|
||||
@ -23,7 +24,7 @@ export class TeamMembersComponent {
|
||||
|
||||
expandedTeam = false;
|
||||
|
||||
constructor(public permissionsService: PermissionsService) {}
|
||||
constructor(private readonly _userService: UserService) {}
|
||||
|
||||
get maxTeamMembersBeforeExpand(): number {
|
||||
return this.perLine - (this.canAdd ? 1 : 0);
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
import { Component, EventEmitter, Input, Output, ViewChild } from '@angular/core';
|
||||
import { AppStateService } from '../../../../../state/app-state.service';
|
||||
import { DossierWrapper } from '../../../../../state/model/dossier.wrapper';
|
||||
import { AppStateService } from '@state/app-state.service';
|
||||
import { DossierWrapper } from '@state/model/dossier.wrapper';
|
||||
import { EditDossierSectionInterface } from '../edit-dossier-section.interface';
|
||||
import { PermissionsService } from '@services/permissions.service';
|
||||
import { TeamMembersManagerComponent } from '../../../components/team-members-manager/team-members-manager.component';
|
||||
import { UserService } from '@services/user.service';
|
||||
|
||||
@Component({
|
||||
selector: 'redaction-edit-dossier-team-members',
|
||||
@ -11,19 +11,21 @@ import { TeamMembersManagerComponent } from '../../../components/team-members-ma
|
||||
styleUrls: ['./edit-dossier-team-members.component.scss']
|
||||
})
|
||||
export class EditDossierTeamMembersComponent implements EditDossierSectionInterface {
|
||||
readonly currentUser = this._userService.currentUser;
|
||||
|
||||
@Input() dossierWrapper: DossierWrapper;
|
||||
@Output() updateDossier = new EventEmitter<any>();
|
||||
|
||||
@ViewChild(TeamMembersManagerComponent) managerComponent: TeamMembersManagerComponent;
|
||||
|
||||
constructor(private readonly _appStateService: AppStateService, private readonly _permissionsService: PermissionsService) {}
|
||||
constructor(private readonly _appStateService: AppStateService, private readonly _userService: UserService) {}
|
||||
|
||||
get changed() {
|
||||
return this.managerComponent.changed;
|
||||
}
|
||||
|
||||
get disabled() {
|
||||
return !this._permissionsService.isManager();
|
||||
return !this.currentUser.isManager;
|
||||
}
|
||||
|
||||
async save() {
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
(action)="openAddDossierDialog()"
|
||||
*ngIf="screenStateService.noData$ | async"
|
||||
[buttonLabel]="'dossier-listing.no-data.action' | translate"
|
||||
[showButton]="permissionsService.isManager()"
|
||||
[showButton]="currentUser.isManager"
|
||||
[text]="'dossier-listing.no-data.title' | translate"
|
||||
icon="red:folder"
|
||||
></redaction-empty-state>
|
||||
|
||||
@ -42,11 +42,12 @@ export class DossierListingScreenComponent
|
||||
readonly itemSize = 95;
|
||||
protected readonly _primaryKey = 'dossierName';
|
||||
readonly tableHeaderLabel = _('dossier-listing.table-header.title');
|
||||
readonly currentUser = this._userService.currentUser;
|
||||
readonly buttonConfigs: ButtonConfig[] = [
|
||||
{
|
||||
label: _('dossier-listing.add-new'),
|
||||
action: () => this.openAddDossierDialog(),
|
||||
hide: !this.permissionsService.isManager(),
|
||||
hide: !this.currentUser.isManager,
|
||||
icon: 'red:plus',
|
||||
type: 'primary'
|
||||
}
|
||||
@ -76,15 +77,15 @@ export class DossierListingScreenComponent
|
||||
private readonly _needsWorkTemplate: TemplateRef<any>;
|
||||
|
||||
constructor(
|
||||
private readonly _translateChartService: TranslateChartService,
|
||||
private readonly _userService: UserService,
|
||||
private readonly _dialogService: DossiersDialogService,
|
||||
private readonly _translateService: TranslateService,
|
||||
private readonly _router: Router,
|
||||
private readonly _appStateService: AppStateService,
|
||||
private readonly _userPreferenceService: UserPreferenceService,
|
||||
protected readonly _injector: Injector,
|
||||
private readonly _userService: UserService,
|
||||
readonly changeDetectorRef: ChangeDetectorRef,
|
||||
protected readonly _injector: Injector
|
||||
private readonly _appStateService: AppStateService,
|
||||
private readonly _translateService: TranslateService,
|
||||
private readonly _dialogService: DossiersDialogService,
|
||||
private readonly _translateChartService: TranslateChartService,
|
||||
private readonly _userPreferenceService: UserPreferenceService
|
||||
) {
|
||||
super(_injector);
|
||||
this._appStateService.reset();
|
||||
|
||||
@ -45,6 +45,7 @@ export class DossierOverviewScreenComponent
|
||||
readonly itemSize = 80;
|
||||
protected readonly _primaryKey = 'filename';
|
||||
readonly tableHeaderLabel = _('dossier-overview.table-header.title');
|
||||
readonly currentUser = this._userService.currentUser;
|
||||
private readonly _lastOpenedFileKey = 'Dossier-Recent-' + this.activeDossier.dossierId;
|
||||
|
||||
readonly actionConfigs: ActionConfig[] = [
|
||||
@ -52,7 +53,7 @@ export class DossierOverviewScreenComponent
|
||||
label: this._translateService.instant('dossier-overview.header-actions.edit'),
|
||||
action: $event => this.openEditDossierDialog($event),
|
||||
icon: 'red:edit',
|
||||
hide: !this.permissionsService.isManager()
|
||||
hide: !this.currentUser.isManager
|
||||
}
|
||||
];
|
||||
readonly tableColumnConfigs: TableColumnConfig<FileStatusWrapper>[] = [
|
||||
@ -98,21 +99,21 @@ export class DossierOverviewScreenComponent
|
||||
@ViewChild('fileInput') private _fileInput: ElementRef;
|
||||
|
||||
constructor(
|
||||
private readonly _userService: UserService,
|
||||
private readonly _router: Router,
|
||||
private readonly _toaster: Toaster,
|
||||
protected readonly _injector: Injector,
|
||||
private readonly _userService: UserService,
|
||||
private readonly _loadingService: LoadingService,
|
||||
private readonly _appStateService: AppStateService,
|
||||
private readonly _appConfigService: AppConfigService,
|
||||
private readonly _translateService: TranslateService,
|
||||
private readonly _dialogService: DossiersDialogService,
|
||||
private readonly _changeDetectorRef: ChangeDetectorRef,
|
||||
private readonly _fileUploadService: FileUploadService,
|
||||
private readonly _statusOverlayService: StatusOverlayService,
|
||||
private readonly _router: Router,
|
||||
private readonly _translateService: TranslateService,
|
||||
private readonly _fileDropOverlayService: FileDropOverlayService,
|
||||
private readonly _appStateService: AppStateService,
|
||||
private readonly _userPreferenceService: UserPreferenceService,
|
||||
private readonly _appConfigService: AppConfigService,
|
||||
private readonly _changeDetectorRef: ChangeDetectorRef,
|
||||
private readonly _loadingService: LoadingService,
|
||||
private readonly _dossierAttributesService: DossierAttributesService,
|
||||
protected readonly _injector: Injector
|
||||
private readonly _fileDropOverlayService: FileDropOverlayService,
|
||||
private readonly _dossierAttributesService: DossierAttributesService
|
||||
) {
|
||||
super(_injector);
|
||||
this._loadEntitiesFromState();
|
||||
@ -122,10 +123,6 @@ export class DossierOverviewScreenComponent
|
||||
return this._appStateService.activeDossier;
|
||||
}
|
||||
|
||||
get userId() {
|
||||
return this._userService.currentUser.id;
|
||||
}
|
||||
|
||||
get checkedRequiredFilters() {
|
||||
return this.filterService.getFilterGroup('quickFilters')?.filters.filter(f => f.required && f.checked);
|
||||
}
|
||||
@ -384,7 +381,7 @@ export class DossierOverviewScreenComponent
|
||||
{
|
||||
key: 'assigned-to-me',
|
||||
label: this._translateService.instant('dossier-overview.quick-filters.assigned-to-me'),
|
||||
checker: (file: FileStatusWrapper) => file.currentReviewer === this.userId
|
||||
checker: (file: FileStatusWrapper) => file.currentReviewer === this.currentUser.id
|
||||
},
|
||||
{
|
||||
key: 'unassigned',
|
||||
@ -394,7 +391,7 @@ export class DossierOverviewScreenComponent
|
||||
{
|
||||
key: 'assigned-to-others',
|
||||
label: this._translateService.instant('dossier-overview.quick-filters.assigned-to-others'),
|
||||
checker: (file: FileStatusWrapper) => !!file.currentReviewer && file.currentReviewer !== this.userId
|
||||
checker: (file: FileStatusWrapper) => !!file.currentReviewer && file.currentReviewer !== this.currentUser.id
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<button [class.overlay]="showDot" mat-button>
|
||||
<redaction-initials-avatar [userId]="user.id" [withName]="true" size="small"></redaction-initials-avatar>
|
||||
<redaction-initials-avatar [userId]="userId" [withName]="true" size="small"></redaction-initials-avatar>
|
||||
<mat-icon svgIcon="iqser:arrow-down"></mat-icon>
|
||||
</button>
|
||||
<div *ngIf="showDot" class="dot"></div>
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
|
||||
import { UserWrapper } from '@services/user.service';
|
||||
|
||||
@Component({
|
||||
selector: 'redaction-user-button',
|
||||
@ -8,6 +7,6 @@ import { UserWrapper } from '@services/user.service';
|
||||
changeDetection: ChangeDetectionStrategy.OnPush
|
||||
})
|
||||
export class UserButtonComponent {
|
||||
@Input() user: UserWrapper;
|
||||
@Input() userId: string;
|
||||
@Input() showDot = false;
|
||||
}
|
||||
|
||||
@ -38,7 +38,7 @@ export class InitialsAvatarComponent extends AutoUnsubscribeComponent implements
|
||||
}
|
||||
|
||||
get disabled(): boolean {
|
||||
return !this._userService.isActive(this.user);
|
||||
return !this.user?.isActive;
|
||||
}
|
||||
|
||||
private get _colorClass() {
|
||||
|
||||
@ -8,8 +8,8 @@ import { FileStatusWrapper } from '@models/file/file-status.wrapper';
|
||||
import { mergeMap, tap } from 'rxjs/operators';
|
||||
import { DownloadStatusWrapper } from '../model/download-status.wrapper';
|
||||
import { AppStateService } from '@state/app-state.service';
|
||||
import { PermissionsService } from '@services/permissions.service';
|
||||
import { KeycloakService } from 'keycloak-angular';
|
||||
import { UserService } from '@services/user.service';
|
||||
|
||||
@Injectable()
|
||||
export class FileDownloadService {
|
||||
@ -18,17 +18,17 @@ export class FileDownloadService {
|
||||
hasPendingDownloads;
|
||||
|
||||
constructor(
|
||||
private readonly _userService: UserService,
|
||||
private readonly _applicationRef: ApplicationRef,
|
||||
private readonly _keycloakService: KeycloakService,
|
||||
private readonly _appStateService: AppStateService,
|
||||
private readonly _permissionsService: PermissionsService,
|
||||
private readonly _downloadControllerService: DownloadControllerService,
|
||||
private readonly _translateService: TranslateService,
|
||||
private readonly _appConfigService: AppConfigService,
|
||||
private readonly _keycloakService: KeycloakService,
|
||||
private readonly _downloadControllerService: DownloadControllerService,
|
||||
private readonly _fileManagementControllerService: FileManagementControllerService
|
||||
) {
|
||||
interval(5000).subscribe(() => {
|
||||
if (_permissionsService.isUser()) {
|
||||
if (_userService.currentUser.isUser) {
|
||||
this.getDownloadStatus().subscribe(() => {});
|
||||
}
|
||||
});
|
||||
|
||||
@ -19,10 +19,6 @@ export class PermissionsService {
|
||||
return this._appStateService.activeDossier;
|
||||
}
|
||||
|
||||
isManager(user?: UserWrapper) {
|
||||
return this._userService.isManager(user);
|
||||
}
|
||||
|
||||
isReviewerOrApprover(fileStatus?: FileStatusWrapper): boolean {
|
||||
return this.isFileReviewer(fileStatus) || this.isApprover();
|
||||
}
|
||||
@ -40,7 +36,7 @@ export class PermissionsService {
|
||||
}
|
||||
|
||||
canToggleAnalysis(fileStatus: FileStatusWrapper): boolean {
|
||||
return this.isManager() && ['UNASSIGNED', 'UNDER_REVIEW', 'UNDER_APPROVAL'].includes(fileStatus.status);
|
||||
return this._userService.currentUser.isManager && ['UNASSIGNED', 'UNDER_REVIEW', 'UNDER_APPROVAL'].includes(fileStatus.status);
|
||||
}
|
||||
|
||||
canReanalyseFile(fileStatus = this._activeFile): boolean {
|
||||
@ -159,22 +155,14 @@ export class PermissionsService {
|
||||
return user.isAdmin;
|
||||
}
|
||||
|
||||
isUserAdmin(user = this._userService.currentUser): boolean {
|
||||
return user.isUserAdmin;
|
||||
}
|
||||
|
||||
isUser(user = this._userService.currentUser): boolean {
|
||||
return user.isUser;
|
||||
}
|
||||
|
||||
canOcrFile(fileStatus = this._activeFile): boolean {
|
||||
return (
|
||||
!fileStatus.isExcluded && !fileStatus.ocrTime && ['UNASSIGNED', 'UNDER_REVIEW', 'UNDER_APPROVAL'].includes(fileStatus.status)
|
||||
);
|
||||
}
|
||||
|
||||
canManageUsers(user?: UserWrapper): boolean {
|
||||
return this.isUserAdmin(user);
|
||||
canManageUsers(user: UserWrapper = this._userService.currentUser): boolean {
|
||||
return user.isUserAdmin;
|
||||
}
|
||||
|
||||
canAddComment(fileStatus = this._activeFile): boolean {
|
||||
|
||||
@ -25,6 +25,7 @@ export class UserWrapper {
|
||||
name = this.firstName && this.lastName ? `${this.firstName} ${this.lastName}` : this.username;
|
||||
searchKey = this.name + this.username + this.email;
|
||||
|
||||
isActive = this.roles.length > 0;
|
||||
isManager = this.roles.indexOf('RED_MANAGER') >= 0;
|
||||
isUserAdmin = this.roles.indexOf('RED_USER_ADMIN') >= 0;
|
||||
isUser = this.roles.indexOf('RED_USER') >= 0;
|
||||
@ -48,10 +49,6 @@ export class UserService {
|
||||
|
||||
private _allRedUsers: UserWrapper[];
|
||||
|
||||
get allRedUsers(): UserWrapper[] {
|
||||
return this._allRedUsers;
|
||||
}
|
||||
|
||||
get managerUsers(): UserWrapper[] {
|
||||
return this._allRedUsers.filter(user => user.isManager);
|
||||
}
|
||||
@ -120,22 +117,6 @@ export class UserService {
|
||||
return user.roles.indexOf('RED_MANAGER') >= 0;
|
||||
}
|
||||
|
||||
isUser(user: UserWrapper = this._currentUser): boolean {
|
||||
return user.roles?.indexOf('RED_USER') >= 0;
|
||||
}
|
||||
|
||||
isUserAdmin(user: UserWrapper = this._currentUser): boolean {
|
||||
return user.roles?.indexOf('RED_USER_ADMIN') >= 0;
|
||||
}
|
||||
|
||||
isAdmin(user: UserWrapper = this._currentUser): boolean {
|
||||
return user.roles?.indexOf('RED_ADMIN') >= 0;
|
||||
}
|
||||
|
||||
isActive(user: UserWrapper = this._currentUser): boolean {
|
||||
return user.roles?.length > 0;
|
||||
}
|
||||
|
||||
hasAnyRole(requiredRoles: string[], user: UserWrapper = this._currentUser) {
|
||||
if (requiredRoles?.length > 0) {
|
||||
for (const role of requiredRoles) if (user.roles.indexOf(role) >= 0) return true;
|
||||
|
||||
@ -24,7 +24,7 @@ export class AppStateGuard implements CanActivate {
|
||||
await this._appStateService.loadDictionaryDataIfNecessary();
|
||||
}
|
||||
|
||||
if (this._userService.isUser()) {
|
||||
if (this._userService.currentUser.isUser) {
|
||||
await this._appStateService.loadAllDossiersIfNecessary();
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user