-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add role auth #32
Add role auth #32
Conversation
It's ready for review after many refactoring and boiled down to the agreed essentials only. Things which should be improved for future (after pilot?):
Things which could be improved:
Open question for after pilot:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking great Marvin, see what you think about the logs and using org slugs
src/middleware.ts
Outdated
// Define user roles | ||
const userRoles = { | ||
isAdmin: orgId === SAFEINSIGHTS_ORG_ID, | ||
isOpenStaxMember: orgId === OPENSTAX_ORG_ID, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should use org slugs vs ids. The ids will change across clerk instances and if we ever accidentally destroy an org and recreate it later, but we can control the slugs so they'd stay the same.
}, | ||
} | ||
|
||
export default logger |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this, but maybe we pull in a "real" logging library that allows filtering and prefixes? I've used https://www.npmjs.com/package/debug before and liked it's functionality
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks great, thanks @therealmarv !
https://openstax.atlassian.net/browse/OTTER-36
It's in regards to the 403 pages a MVP. But the focus is more that members cannot be researchers and vice versa (protect routes). Also non logged in users should not access any member or researcher pages (which before this PR was possible). The 403 page could definitely look "nice" or "styled". If that's needed on top I would prefer to built on top of this PR.