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

Inbuilt groups for permissions #568

Merged
merged 13 commits into from
Oct 21, 2023
Merged

Inbuilt groups for permissions #568

merged 13 commits into from
Oct 21, 2023

Conversation

illusional
Copy link
Collaborator

@illusional illusional commented Oct 6, 2023

Inbuilt groups for permissions, allow us to be quicker with group lookups, and create custom groups easier for specific permissions.

This creates group + group_member tables, + adds some plumbing on the ProjectPermissions table.

Would require the pulumi bot to connect to metamist to update group members, probably not a hard task tbh.


When adding tests, I realised the method names and implementations are a bit over the place, so I pulled them apart, renamed a bunch and added cleaner implementations in some places.

@illusional illusional marked this pull request as ready for review October 19, 2023 03:22
@codecov-commenter
Copy link

codecov-commenter commented Oct 19, 2023

Codecov Report

Attention: 71 lines in your changes are missing coverage. Please review.

Comparison is base (040759e) 70.42% compared to head (d05a19b) 71.30%.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev     #568      +/-   ##
==========================================
+ Coverage   70.42%   71.30%   +0.87%     
==========================================
  Files         115      116       +1     
  Lines        9167     9263      +96     
==========================================
+ Hits         6456     6605     +149     
+ Misses       2711     2658      -53     
Files Coverage Δ
db/python/layers/search.py 89.36% <100.00%> (ø)
db/python/layers/web.py 88.70% <100.00%> (ø)
db/python/utils.py 82.92% <100.00%> (+2.55%) ⬆️
models/models/project.py 100.00% <100.00%> (ø)
test/test_project_groups.py 100.00% <100.00%> (ø)
test/testbase.py 82.45% <100.00%> (+0.31%) ⬆️
api/graphql/loaders.py 84.86% <0.00%> (ø)
api/routes/web.py 46.34% <75.00%> (ø)
db/python/layers/analysis.py 47.95% <0.00%> (ø)
db/python/layers/seqr.py 20.32% <75.00%> (+0.77%) ⬆️
... and 5 more

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

--pretty,
--show-error-codes,
--no-strict-optional,
--ignore-missing-imports,
--install-types,
--non-interactive,
--show-error-context,
# --show-error-context,
Copy link
Contributor

Choose a reason for hiding this comment

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

What was the reason to comment it out?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It seemed to show too much context, and the regular does enough to solve most problems :)

]
async def get_all_projects(self, author: str):
"""Get all projects"""
await self.check_project_creator_permissions(author)
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a silly question.
Does this mean if user who is not in 'project-creators' and would call api route project/all, would get Forbidden exception?
Should user gets the list of all projects he/she is allowed to view?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Great question! There's a /my equivalent route for that, this was handy for specific applications that need all projects or fail

@illusional illusional mentioned this pull request Oct 20, 2023
@illusional illusional merged commit 8dcd99e into dev Oct 21, 2023
2 checks passed
@illusional illusional deleted the inbuilt-permissions branch October 21, 2023 16:43
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