joystick
joystick copied to clipboard
Add req.context.ifAuthorized() and req.context.ifNotAuthorized() redirects
Identical to behavior of req.context.ifLoggedIn and req.context.ifNotLoggedIn. API would look something like this:
req.context.ifAuthorized('role_to_check', '/route-if-has-role', () => {
// Do this if they do not have the role.
});
req.context.ifNotAuthorized('role_to_check', '/route-if-not-has-role', () => {
// Do this if they have the role.
});
Just need to account for NoSQL vs SQL queries when checking roles.