Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Update AuthorisationService when creating new work package

Oliver Günther8c36da21090e
diff --git a/frontend/src/app/components/wp-new/wp-create.service.ts b/frontend/src/app/components/wp-new/wp-create.service.ts
index 78802558593..ef14d261495 100644
--- a/frontend/src/app/components/wp-new/wp-create.service.ts
+++ b/frontend/src/app/components/wp-new/wp-create.service.ts
@@ -46,6 +46,7 @@ import {WorkPackageDmService} from "core-app/modules/hal/dm-services/work-packag
import {FormResource} from "core-app/modules/hal/resources/form-resource";
import {HalEventsService} from "core-app/modules/hal/services/hal-events.service";
import {ResourceChangeset} from "core-app/modules/fields/changeset/resource-changeset";
+import {AuthorisationService} from "core-app/modules/common/model-auth/model-auth.service";
export const newWorkPackageHref = '/api/v3/work_packages/new';
@@ -60,10 +61,11 @@ export class WorkPackageCreateService implements OnDestroy {
protected hooks:HookService,
protected wpCacheService:WorkPackageCacheService,
protected halResourceService:HalResourceService,
- protected readonly querySpace:IsolatedQuerySpace,
+ protected querySpace:IsolatedQuerySpace,
+ protected authorisationService:AuthorisationService,
protected halEditing:HalResourceEditingService,
protected workPackageDmService:WorkPackageDmService,
- protected readonly halEvents:HalEventsService) {
+ protected halEvents:HalEventsService) {
this.halEditing
.comittedChanges
@@ -179,6 +181,7 @@ export class WorkPackageCreateService implements OnDestroy {
}
return changePromise.then((change:WorkPackageChangeset) => {
+ this.authorisationService.initModelAuth('work_package', change.pristineResource);
this.halEditing.updateValue(newWorkPackageHref, change);
this.wpCacheService.updateWorkPackage(change.pristineResource);