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;
|
return fileStatus.currentReviewer === this._userService.userId;
|
||||||
}
|
}
|
||||||
|
|
||||||
canDeleteFile(fileStatus?: FileStatusWrapper) {
|
canDeleteFile(fileStatus?: FileStatusWrapper, project?: Project) {
|
||||||
return this.isManagerAndOwner() || fileStatus.isUnassigned;
|
return this.isManagerAndOwner(project) || fileStatus.isUnassigned;
|
||||||
}
|
}
|
||||||
|
|
||||||
isApprovedOrUnderApproval(fileStatus?: FileStatusWrapper) {
|
isApprovedOrUnderApproval(fileStatus?: FileStatusWrapper) {
|
||||||
@ -189,4 +189,11 @@ export class PermissionsService {
|
|||||||
}
|
}
|
||||||
return fileStatus.status === 'APPROVED' && this.isManagerAndOwner();
|
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>
|
></redaction-filter>
|
||||||
</div>
|
</div>
|
||||||
<redaction-icon-button
|
<redaction-icon-button
|
||||||
*ngIf="userService.isManager(user)"
|
*ngIf="permissionsService.isManager()"
|
||||||
icon="red:plus"
|
icon="red:plus"
|
||||||
(action)="openAddProjectDialog()"
|
(action)="openAddProjectDialog()"
|
||||||
text="project-listing.add-new"
|
text="project-listing.add-new"
|
||||||
@ -97,10 +97,10 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="status-container">
|
<div class="status-container">
|
||||||
<redaction-status-bar [config]="getProjectStatusConfig(pw)"></redaction-status-bar>
|
<redaction-status-bar [config]="getProjectStatusConfig(pw)"></redaction-status-bar>
|
||||||
|
<div class="action-buttons">
|
||||||
<div class="action-buttons" *ngIf="permissionsService.isManager()">
|
|
||||||
<redaction-circle-button
|
<redaction-circle-button
|
||||||
(action)="openDeleteProjectDialog($event, pw.project)"
|
(action)="openDeleteProjectDialog($event, pw.project)"
|
||||||
|
*ngIf="permissionsService.canDeleteProject(pw)"
|
||||||
tooltip="project-listing.delete.action"
|
tooltip="project-listing.delete.action"
|
||||||
type="dark-bg"
|
type="dark-bg"
|
||||||
icon="red:trash"
|
icon="red:trash"
|
||||||
@ -109,6 +109,7 @@
|
|||||||
|
|
||||||
<redaction-circle-button
|
<redaction-circle-button
|
||||||
(action)="openEditProjectDialog($event, pw.project)"
|
(action)="openEditProjectDialog($event, pw.project)"
|
||||||
|
*ngIf="permissionsService.isManager()"
|
||||||
tooltip="project-listing.edit.action"
|
tooltip="project-listing.edit.action"
|
||||||
type="dark-bg"
|
type="dark-bg"
|
||||||
icon="red:edit"
|
icon="red:edit"
|
||||||
@ -127,6 +128,7 @@
|
|||||||
|
|
||||||
<redaction-circle-button
|
<redaction-circle-button
|
||||||
(action)="openAssignProjectOwnerDialog($event, pw.project)"
|
(action)="openAssignProjectOwnerDialog($event, pw.project)"
|
||||||
|
*ngIf="permissionsService.isManager()"
|
||||||
tooltip="project-listing.assign.action"
|
tooltip="project-listing.assign.action"
|
||||||
type="dark-bg"
|
type="dark-bg"
|
||||||
icon="red:assign"
|
icon="red:assign"
|
||||||
|
|||||||
@ -26,12 +26,14 @@
|
|||||||
|
|
||||||
<div class="actions">
|
<div class="actions">
|
||||||
<redaction-circle-button
|
<redaction-circle-button
|
||||||
|
*ngIf="permissionsService.isManagerAndOwner()"
|
||||||
(action)="openEditProjectDialog($event)"
|
(action)="openEditProjectDialog($event)"
|
||||||
tooltip="project-overview.header-actions.edit"
|
tooltip="project-overview.header-actions.edit"
|
||||||
tooltipPosition="below"
|
tooltipPosition="below"
|
||||||
icon="red:edit"
|
icon="red:edit"
|
||||||
></redaction-circle-button>
|
></redaction-circle-button>
|
||||||
<redaction-circle-button
|
<redaction-circle-button
|
||||||
|
*ngIf="permissionsService.canDeleteProject()"
|
||||||
(action)="openDeleteProjectDialog($event)"
|
(action)="openDeleteProjectDialog($event)"
|
||||||
tooltip="project-overview.header-actions.delete"
|
tooltip="project-overview.header-actions.delete"
|
||||||
tooltipPosition="below"
|
tooltipPosition="below"
|
||||||
@ -46,6 +48,7 @@
|
|||||||
icon="red:report"
|
icon="red:report"
|
||||||
></redaction-circle-button>
|
></redaction-circle-button>
|
||||||
<redaction-circle-button
|
<redaction-circle-button
|
||||||
|
*ngIf="permissionsService.isManagerAndOwner()"
|
||||||
(action)="openAssignProjectMembersDialog()"
|
(action)="openAssignProjectMembersDialog()"
|
||||||
tooltip="project-overview.header-actions.assign"
|
tooltip="project-overview.header-actions.assign"
|
||||||
tooltipPosition="below"
|
tooltipPosition="below"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user