IGNITE-6446 Fix permission transition hook and permissions for basic configuration screen. (cherry picked from commit 0f8a2bf)
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/58ba0444 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/58ba0444 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/58ba0444 Branch: refs/heads/ignite-2.1.5-p1 Commit: 58ba04444d229476b502241940e474c25f0d895c Parents: bd60ab1 Author: Ilya Borisov <klast...@gmail.com> Authored: Thu Sep 21 10:25:19 2017 +0700 Committer: Alexey Kuznetsov <akuznet...@apache.org> Committed: Thu Sep 21 10:26:22 2017 +0700 ---------------------------------------------------------------------- .../frontend/app/modules/states/configuration.state.js | 1 + modules/web-console/frontend/app/modules/user/user.module.js | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/58ba0444/modules/web-console/frontend/app/modules/states/configuration.state.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/modules/states/configuration.state.js b/modules/web-console/frontend/app/modules/states/configuration.state.js index d2c1410..8d05a45 100644 --- a/modules/web-console/frontend/app/modules/states/configuration.state.js +++ b/modules/web-console/frontend/app/modules/states/configuration.state.js @@ -77,6 +77,7 @@ angular.module('ignite-console.states.configuration', ['ui.router']) }) .state('base.configuration.tabs.basic', { url: '/basic', + permission: 'configuration', template: '<page-configure-basic></page-configure-basic>', tfMetaTags: { title: 'Basic Configuration' http://git-wip-us.apache.org/repos/asf/ignite/blob/58ba0444/modules/web-console/frontend/app/modules/user/user.module.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/modules/user/user.module.js b/modules/web-console/frontend/app/modules/user/user.module.js index 5cd8bc5..5ab0e0f 100644 --- a/modules/web-console/frontend/app/modules/user/user.module.js +++ b/modules/web-console/frontend/app/modules/user/user.module.js @@ -69,14 +69,14 @@ angular.module('ignite-console.user', [ AclService.attachRole(role); }); - $transitions.onEnter({}, (trans) => { + $transitions.onBefore({}, (trans) => { const $state = trans.router.stateService; const {name, permission} = trans.to(); if (_.isEmpty(permission)) return; - trans.injector().get('User').read() + return trans.injector().get('User').read() .then(() => { if (AclService.can(permission)) { Activities.post({action: $state.href(name, trans.params('to'))}); @@ -85,6 +85,9 @@ angular.module('ignite-console.user', [ } return $state.target(trans.to().failState || '403'); + }) + .catch(() => { + return $state.target(trans.to().failState || '403'); }); }); }]);