fix RED-3486
This commit is contained in:
parent
3bd75bd1ca
commit
268a58eb79
@ -2,12 +2,17 @@ import { Injectable } from '@angular/core';
|
||||
import { UserService } from './user.service';
|
||||
import { Dossier, File, IComment, IDossier } from '@red/domain';
|
||||
import { DossiersService } from './entity-services/dossiers.service';
|
||||
import { FilesMapService } from '@services/entity-services/files-map.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class PermissionsService {
|
||||
constructor(private readonly _userService: UserService, private readonly _dossiersService: DossiersService) {}
|
||||
constructor(
|
||||
private readonly _userService: UserService,
|
||||
private readonly _dossiersService: DossiersService,
|
||||
private readonly _filesMapService: FilesMapService,
|
||||
) {}
|
||||
|
||||
isReviewerOrApprover(file: File): boolean {
|
||||
const dossier = this._getDossier(file);
|
||||
@ -15,7 +20,7 @@ export class PermissionsService {
|
||||
}
|
||||
|
||||
displayReanalyseBtn(dossier: Dossier): boolean {
|
||||
return this.isApprover(dossier);
|
||||
return this.isApprover(dossier) && this._filesMapService.get(dossier.dossierId).length > 0;
|
||||
}
|
||||
|
||||
canEditFileAttributes(file: File): boolean {
|
||||
|
||||
@ -37,6 +37,10 @@ export class UserService extends EntitiesService<User, IUser> {
|
||||
}
|
||||
|
||||
async initialize(): Promise<void> {
|
||||
if (!this.currentUser) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.currentUser.isUserAdmin || this.currentUser.isUser || this.currentUser.isAdmin) {
|
||||
await firstValueFrom(this.loadAll());
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user