angular-permission

Check if user has permission to access specific states

假如想象 提交于 2019-12-10 00:48:02
问题 I use angular-permission and I want to check if user has access to specific states. My state config: $stateProvider .state('app', { url: '/', abstract: true, data: { permissions: { only: ['BASE'] } } }) Is there a method or something which I can use in controllers to determine it? // somewhere in controller if (Permission.hasAccessToState('app')) { // I want to check if user has access to state without navigating to it }; If anyone is interested, here is a corresponding discussion on github.

Check if user has permission to access specific states

走远了吗. 提交于 2019-12-04 20:53:57
I use angular-permission and I want to check if user has access to specific states. My state config: $stateProvider .state('app', { url: '/', abstract: true, data: { permissions: { only: ['BASE'] } } }) Is there a method or something which I can use in controllers to determine it? // somewhere in controller if (Permission.hasAccessToState('app')) { // I want to check if user has access to state without navigating to it }; If anyone is interested, here is a corresponding discussion on github . I did not find something in the documentation wiki. But according to the source and comment there