question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Check if user has permission to access specific states

See original GitHub issue

It would be nice to have ability to check during run phase or in controllers if user has access to specific states. Something like:

StateAuthorization.hasAccessTo('app.myState');

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:5
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
golineycommented, Jul 26, 2016

Personally speaking, I’d like to have non blocking method for checking state availability. But I’m not sure if it complies to angular-permission nature. Anyway, approach above solves my problem.

1reaction
golineycommented, Jul 26, 2016

Regarding defect in permission-sref I’ve created a separate issue #305

Regarding checking state availability in run/controller. Here is an approach I have:

var statePermissionMap = new StatePermissionMap(state);

StateAuthorization
    .authorize(statePermissionMap)
    .then(function () {
         //authorized
    })
    .catch(function (rejectedPermission) {
        //unauthorized
    })
Read more comments on GitHub >

github_iconTop Results From Across the Web

Check if user has permission to access specific states
new PermissionMap(state.data.permissions); doesn't seem to take into account permissions of parent states. It's doubtful, that it will work.
Read more >
How to Check Permissions of Files and Folders in Windows
Step 4 – In the “Permissions” tab, you can see the permissions held by users over a particular file or folder. Figure 1:...
Read more >
Using the Permissions API - MDN Web Docs
For example, it can query whether permission to use a particular API is granted or denied, and specifically request permission to use an...
Read more >
Angular - How to check authorization based on role and entity ...
Basically what it does is to look a valid entry and check if the current user roles are included in the permittedRoles. File...
Read more >
Permissions (Database Engine) - SQL Server - Microsoft Learn
Base securable Granular permissions on base securable Securable that contains bas... APPLICATION ROLE ALTER DATABASE APPLICATION ROLE CONTROL DATABASE APPLICATION ROLE VIEW DEFINITION DATABASE
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found