Skip to content
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

User inheritance and roles #627

Merged
merged 38 commits into from
Oct 12, 2021
Merged

User inheritance and roles #627

merged 38 commits into from
Oct 12, 2021

Conversation

i-oden
Copy link
Member

@i-oden i-oden commented Oct 12, 2021

Joined table inheritance for users:

  • User : Base user table, including all rows which all user types should have
    • ResearchUser: Connected to projects via the ProjectUsers association table.
      • The association table also has an extra column called owner which allows the user to be a projectowner for some projects (with some admin permissions) and only a team member in some (only list and download permissions)
    • UnitUser: Does not have a connection to the projects table directly, only through the connected unit.
      • A UnitUser has two different possible roles depending on the is_admin column: Unit Personnel / Unit Admin
    • SuperAdmin: Us at DC -- we can do anything. Not a lot implemented here, mostly focusing on the others.

The endpoints should also be fixed so that they have @auth.login_required(roles=[".."]) where it's applicable.

NOTE! The code is being refactored, this is an initial PR for the roles and inheritance to work. This is due to that the PR will become huge if I do everything at once.

@i-oden i-oden requested review from alneberg, aanil and worukan October 12, 2021 06:37
@i-oden i-oden self-assigned this Oct 12, 2021
@i-oden i-oden marked this pull request as draft October 12, 2021 06:46
@i-oden i-oden marked this pull request as ready for review October 12, 2021 09:47
dds_web/security/auth.py Outdated Show resolved Hide resolved
dds_web/api/errors.py Outdated Show resolved Hide resolved
@i-oden i-oden mentioned this pull request Oct 12, 2021
@i-oden i-oden requested a review from alneberg October 12, 2021 12:47
Copy link
Contributor

@alneberg alneberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good and seems to work!

@i-oden i-oden removed the request for review from worukan October 12, 2021 13:14
Copy link
Contributor

@aanil aanil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Looks good to me!

@i-oden i-oden merged commit f476490 into dev Oct 12, 2021
@i-oden i-oden deleted the user-inheritance-and-roles branch October 12, 2021 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants