Skip to content

Add concept of user groups #1062

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

Draft
wants to merge 19 commits into
base: main
Choose a base branch
from
Draft

Add concept of user groups #1062

wants to merge 19 commits into from

Conversation

ml-evs
Copy link
Member

@ml-evs ml-evs commented Mar 11, 2025

This PR adds the concept of groups of users, and the corresponding API routes and UIs. The aim of groups is to be able to provide blanket permissions to subsets of users. Some statements:

  • Users are created without any group.
  • Currently only admins can create groups and assign users to them, though it is already possible to list users as admins for a group (and in future they will control access).

Still to-do:

  • Use these in permissions lookups
  • Allow users to assign samples as visible to groups on creation and edit
  • Default permissions for groups

Copy link

codecov bot commented Mar 11, 2025

Codecov Report

Attention: Patch coverage is 54.50980% with 116 lines in your changes missing coverage. Please review.

Project coverage is 73.32%. Comparing base (187c364) to head (e6ac55d).
Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
pydatalab/src/pydatalab/routes/v0_1/admin.py 33.72% 57 Missing ⚠️
pydatalab/src/pydatalab/routes/v0_1/items.py 36.61% 45 Missing ⚠️
pydatalab/src/pydatalab/mongo.py 64.70% 6 Missing ⚠️
pydatalab/src/pydatalab/permissions.py 63.63% 4 Missing ⚠️
pydatalab/src/pydatalab/routes/v0_1/groups.py 92.00% 2 Missing ⚠️
pydatalab/src/pydatalab/login.py 90.90% 1 Missing ⚠️
pydatalab/src/pydatalab/routes/v0_1/users.py 91.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1062      +/-   ##
==========================================
+ Coverage   71.73%   73.32%   +1.59%     
==========================================
  Files          66       67       +1     
  Lines        4482     4701     +219     
==========================================
+ Hits         3215     3447     +232     
+ Misses       1267     1254      -13     
Files with missing lines Coverage Δ
pydatalab/src/pydatalab/models/people.py 93.68% <100.00%> (+1.18%) ⬆️
pydatalab/src/pydatalab/models/traits.py 98.70% <100.00%> (+0.09%) ⬆️
pydatalab/src/pydatalab/routes/v0_1/__init__.py 100.00% <100.00%> (ø)
pydatalab/src/pydatalab/login.py 84.50% <90.90%> (+0.38%) ⬆️
pydatalab/src/pydatalab/routes/v0_1/users.py 91.07% <91.66%> (-0.04%) ⬇️
pydatalab/src/pydatalab/routes/v0_1/groups.py 92.00% <92.00%> (ø)
pydatalab/src/pydatalab/permissions.py 83.92% <63.63%> (-1.49%) ⬇️
pydatalab/src/pydatalab/mongo.py 77.77% <64.70%> (-3.05%) ⬇️
pydatalab/src/pydatalab/routes/v0_1/items.py 75.06% <36.61%> (-6.70%) ⬇️
pydatalab/src/pydatalab/routes/v0_1/admin.py 45.52% <33.72%> (-23.71%) ⬇️

... and 15 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link

cypress bot commented Mar 11, 2025

datalab    Run #3525

Run Properties:  status check passed Passed #3525  •  git commit ab834539be ℹ️: Merge e6ac55d8598a780110f7faa45b5c78f70d61abf0 into c51623496dfb3e4766384289dfc2...
Project datalab
Branch Review ml-evs/user-groups
Run status status check passed Passed #3525
Run duration 08m 30s
Commit git commit ab834539be ℹ️: Merge e6ac55d8598a780110f7faa45b5c78f70d61abf0 into c51623496dfb3e4766384289dfc2...
Committer Matthew Evans
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 504
View all changes introduced in this branch ↗︎

@ml-evs ml-evs force-pushed the ml-evs/user-groups branch from 8f3071c to 5da5920 Compare March 11, 2025 13:39
@ml-evs ml-evs force-pushed the ml-evs/user-groups branch from 5da5920 to 34d5719 Compare March 11, 2025 13:45
@ml-evs ml-evs force-pushed the ml-evs/user-groups branch from 4806a68 to 4123e7b Compare March 11, 2025 21:23
@ml-evs ml-evs force-pushed the ml-evs/user-groups branch from 44e7058 to 92424a1 Compare March 11, 2025 21:46
@ml-evs ml-evs force-pushed the ml-evs/user-groups branch from 92424a1 to eae5cdf Compare March 11, 2025 21:54
@ml-evs ml-evs force-pushed the ml-evs/user-groups branch from d56a0ab to 6d01fdc Compare March 14, 2025 14:25
@ml-evs ml-evs added this to the v0.6.x milestone Jun 7, 2025
@ml-evs ml-evs self-assigned this Jun 7, 2025
@ml-evs ml-evs added the enhancement New feature or request label Jun 7, 2025
@BenjaminCharmes
Copy link
Contributor

Users can now see items if they:

  1. Created the item (existing)
  2. Are a member of a group the item is shared with (new)
  3. Are an admin of a group the item is shared with (new)
  • Users can only share items with groups they belong to or administer

I've also updated the UI:

  • In the administrator panel, you can now create, update or delete groups.
  • On an item page, you can share this item with the groups you belong to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants