Skip to content

Permissions and Access Rights within controllers #125

Discussion options

You must be logged in to vote

Sorry for the delay.

Your policies should look like:

module.exports.policies = {
    '*': true, // This opens the door wide open if there isn't a policy configured for the route.

    AdminController: {
        '*': ['isLoggedIn'], // This is for any files in 'api/admin' that don't have an explicit policy set (like below).
        'can-edit': ['isLoggedIn', 'isClnManager'], // This is for 'api/admin/can-edit.js'
        'can-delete': ['isLoggedIn', 'isClnManager'] // This is for 'api/admin/can-delete.js'
     }
};

The order goes "Explicit > Generic". If there isn't an explicit policy set, it goes to the next least-generic policy. So, in this case, there are the 2 routes that are explicitl…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@neonexus
Comment options

Answer selected by MaheshkumarSundaram
@MaheshkumarSundaram
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
good first issue Good for newcomers
2 participants