From 1bdf2305030635191414d70f59825327f78beb17 Mon Sep 17 00:00:00 2001 From: Wieland Lindenthal Date: Mon, 20 Mar 2017 16:47:03 +0100 Subject: [PATCH] Quick solution for bug #24417 --- .../app/components/wp-create/wp-create.controller.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/frontend/app/components/wp-create/wp-create.controller.ts b/frontend/app/components/wp-create/wp-create.controller.ts index 6ca360f580..e25e714ce3 100644 --- a/frontend/app/components/wp-create/wp-create.controller.ts +++ b/frontend/app/components/wp-create/wp-create.controller.ts @@ -40,6 +40,7 @@ import {WorkPackageTableSelection} from '../wp-fast-table/state/wp-table-selecti import {States} from '../states.service'; export class WorkPackageCreateController { + public newWorkPackage:WorkPackageResource|any; public parentWorkPackage:WorkPackageResource|any; public successState:string; @@ -74,6 +75,7 @@ export class WorkPackageCreateController { protected $scope:ng.IScope, protected $rootScope:IRootScopeService, protected $q:ng.IQService, + protected $location:ng.ILocationService, protected I18n:op.I18n, protected wpNotificationsService:WorkPackageNotificationService, protected states:States, @@ -97,7 +99,15 @@ export class WorkPackageCreateController { }); } }) - .catch(error => this.wpNotificationsService.handleErrorResponse(error)); + .catch(error => { + if (error.errorIdentifier == "urn:openproject-org:api:v3:errors:MissingPermission") { + let url: string = $location.absUrl(); + $location.path('/login').search({back_url: url}); + let loginUrl: string = $location.absUrl(); + window.location.href = loginUrl; + }; + this.wpNotificationsService.handleErrorResponse(error); + }); } public switchToFullscreen() {