joystick icon indicating copy to clipboard operation
joystick copied to clipboard

Add req.context.ifAuthorized() and req.context.ifNotAuthorized() redirects

Open rglover opened this issue 2 years ago • 0 comments

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.

rglover avatar Sep 26 '23 16:09 rglover