unified rules for edit and delete of projects
This commit is contained in:
parent
c59c58d1a0
commit
7ae0a2fa5e
@ -66,8 +66,8 @@ export class PermissionsService {
|
||||
return fileStatus.currentReviewer === this._userService.userId;
|
||||
}
|
||||
|
||||
canDeleteFile(fileStatus?: FileStatusWrapper) {
|
||||
return this.isManagerAndOwner() || fileStatus.isUnassigned;
|
||||
canDeleteFile(fileStatus?: FileStatusWrapper, project?: Project) {
|
||||
return this.isManagerAndOwner(project) || fileStatus.isUnassigned;
|
||||
}
|
||||
|
||||
isApprovedOrUnderApproval(fileStatus?: FileStatusWrapper) {
|
||||
@ -189,4 +189,11 @@ export class PermissionsService {
|
||||
}
|
||||
return fileStatus.status === 'APPROVED' && this.isManagerAndOwner();
|
||||
}
|
||||
|
||||
canDeleteProject(project?: ProjectWrapper) {
|
||||
if (!project) {
|
||||
project = this._appStateService.activeProject;
|
||||
}
|
||||
return project.files.reduce((acc, file) => acc && this.canDeleteFile(file, project.project), true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
></redaction-filter>
|
||||
</div>
|
||||
<redaction-icon-button
|
||||
*ngIf="userService.isManager(user)"
|
||||
*ngIf="permissionsService.isManager()"
|
||||
icon="red:plus"
|
||||
(action)="openAddProjectDialog()"
|
||||
text="project-listing.add-new"
|
||||
@ -97,10 +97,10 @@
|
||||
</div>
|
||||
<div class="status-container">
|
||||
<redaction-status-bar [config]="getProjectStatusConfig(pw)"></redaction-status-bar>
|
||||
|
||||
<div class="action-buttons" *ngIf="permissionsService.isManager()">
|
||||
<div class="action-buttons">
|
||||
<redaction-circle-button
|
||||
(action)="openDeleteProjectDialog($event, pw.project)"
|
||||
*ngIf="permissionsService.canDeleteProject(pw)"
|
||||
tooltip="project-listing.delete.action"
|
||||
type="dark-bg"
|
||||
icon="red:trash"
|
||||
@ -109,6 +109,7 @@
|
||||
|
||||
<redaction-circle-button
|
||||
(action)="openEditProjectDialog($event, pw.project)"
|
||||
*ngIf="permissionsService.isManager()"
|
||||
tooltip="project-listing.edit.action"
|
||||
type="dark-bg"
|
||||
icon="red:edit"
|
||||
@ -127,6 +128,7 @@
|
||||
|
||||
<redaction-circle-button
|
||||
(action)="openAssignProjectOwnerDialog($event, pw.project)"
|
||||
*ngIf="permissionsService.isManager()"
|
||||
tooltip="project-listing.assign.action"
|
||||
type="dark-bg"
|
||||
icon="red:assign"
|
||||
|
||||
@ -26,12 +26,14 @@
|
||||
|
||||
<div class="actions">
|
||||
<redaction-circle-button
|
||||
*ngIf="permissionsService.isManagerAndOwner()"
|
||||
(action)="openEditProjectDialog($event)"
|
||||
tooltip="project-overview.header-actions.edit"
|
||||
tooltipPosition="below"
|
||||
icon="red:edit"
|
||||
></redaction-circle-button>
|
||||
<redaction-circle-button
|
||||
*ngIf="permissionsService.canDeleteProject()"
|
||||
(action)="openDeleteProjectDialog($event)"
|
||||
tooltip="project-overview.header-actions.delete"
|
||||
tooltipPosition="below"
|
||||
@ -46,6 +48,7 @@
|
||||
icon="red:report"
|
||||
></redaction-circle-button>
|
||||
<redaction-circle-button
|
||||
*ngIf="permissionsService.isManagerAndOwner()"
|
||||
(action)="openAssignProjectMembersDialog()"
|
||||
tooltip="project-overview.header-actions.assign"
|
||||
tooltipPosition="below"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user