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

Add researcher codes #197

Merged
merged 4 commits into from
Dec 11, 2024
Merged

Add researcher codes #197

merged 4 commits into from
Dec 11, 2024

Conversation

lkeegan
Copy link
Member

@lkeegan lkeegan commented Dec 5, 2024

  • backend
    • add ResearchGroup model with 6-digit id code for users to use when signing up
    • add checkdigit dependency to add checksum to code
    • add full_data_access flag to users if they should have research access to all data
  • admin frontend users tab
    • add reseach_group_id & full_data_access to table
    • add button to add create a research code for a researcher
  • frontend
    • add ResearchCodeInput input which checks the entered code checksum is valid
    • add optional code input to user signup, remove role selection
    • make url for signup /signup
    • add optional code e.g. /signup/123451 to allow researchers to send sign-up links to their users with code pre-filled
    • add cdigit dependency to validate codes
  • resolves Research users should have a code #185

@codecov-commenter
Copy link

codecov-commenter commented Dec 5, 2024

Codecov Report

Attention: Patch coverage is 47.36842% with 60 lines in your changes missing coverage. Please review.

Project coverage is 34.60%. Comparing base (09161ff) to head (d5de23b).

Files with missing lines Patch % Lines
...rontend/src/lib/components/UserRegistration.svelte 0.00% 21 Missing ⚠️
frontend/src/lib/components/Admin/Users.svelte 0.00% 13 Missing ⚠️
.../lib/components/DataInput/ResearchCodeInput.svelte 0.00% 10 Missing and 1 partial ⚠️
.../src/mondey_backend/routers/admin_routers/users.py 78.04% 9 Missing ⚠️
mondey_backend/src/mondey_backend/users.py 75.00% 3 Missing ⚠️
frontend/src/lib/components/FrontPageCard.svelte 0.00% 1 Missing ⚠️
frontend/src/lib/components/UserLogin.svelte 0.00% 1 Missing ⚠️
frontend/src/routes/signup/[[code]]/+page.svelte 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #197      +/-   ##
==========================================
+ Coverage   33.92%   34.60%   +0.68%     
==========================================
  Files         107      109       +2     
  Lines        3664     3742      +78     
  Branches       93       94       +1     
==========================================
+ Hits         1243     1295      +52     
- Misses       2343     2368      +25     
- Partials       78       79       +1     

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

@lkeegan lkeegan requested a review from MaHaWo December 5, 2024 12:43
Copy link
Collaborator

@MaHaWo MaHaWo left a comment

Choose a reason for hiding this comment

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

code looks good.

  • Wrt the optional code in the signup link: Could this functionality potentially be misused if the link is accidentally sent to a wrong person for example? Are these signup links valid forever?
  • does the checksum mechanics have additional use cases (in the research data download perhaps?)

@lkeegan
Copy link
Member Author

lkeegan commented Dec 10, 2024

code looks good.

  • Wrt the optional code in the signup link: Could this functionality potentially be misused if the link is accidentally sent to a wrong person for example? Are these signup links valid forever?
  • does the checksum mechanics have additional use cases (in the research data download perhaps?)

yes the code is valid forever, and associates the user with the researcher. But what we should do is check that the provided code is an existing research code & if not maybe just remove it, to avoid the unlikely scenario where a user signs up with a random valid code, and later a researcher is created with by coincidence exactly this code

@lkeegan lkeegan force-pushed the fix_185_add_researcher_codes branch from 524782a to 06ec581 Compare December 11, 2024 10:40
- backend
  - add ResearchGroup model with 6-digit id code for users to use when signing up
  - add checkdigit dependency to add checksum to code
  - add full_data_access flag to users if they should have research access to all data
- admin frontend users tab
  - add reseach_group_id & full_data_access to table
  - add button to add create a research code for a researcher
- frontend
  - add ResearchCodeInput input which checks the entered code checksum is valid
  - add optional code input to user signup, remove role selection
  - make url for signup /signup
  - add optional code e.g. /signup/123451 to allow researchers to send sign-up links to their users with code pre-filled
  - add cdigit dependency to validate codes
- resolves #185
…likely) scenario with unintentional sharing of data
@lkeegan lkeegan force-pushed the fix_185_add_researcher_codes branch from 14e7bf1 to d5de23b Compare December 11, 2024 19:21
Copy link

sonarqubecloud bot commented Dec 11, 2024

Quality Gate Passed Quality Gate passed

Issues
1 New issue
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarQube Cloud

@lkeegan lkeegan merged commit de3f78d into main Dec 11, 2024
7 checks passed
@lkeegan lkeegan deleted the fix_185_add_researcher_codes branch December 11, 2024 19:23
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.

Research users should have a code
3 participants