Skip to content

Conversation

@pcrespov
Copy link
Member

@pcrespov pcrespov commented Apr 22, 2025

What do these changes do?

ReDoc

This PR adds new endpoints to the web API to support an admin view of user accounts and to allow approval or rejection of account requests.

These features will be implemented in separate PRs.

Admin Workflow Overview

The admin view provides visibility into:

  • Pre-registered user accounts
    • Statuses: PENDING, APPROVED, REJECTED
  • Registered user
    • Statuses: CONFIRMATION_PENDING, ACTIVE, DELETED, BANNED
    • Users may:
      • Have a pre-registration entry (pre_registration exists)
      • Not have a pre-registration entry (no pre_registration)

A user therefore can be in any of these states

stateDiagram-v2
    [*] --> PENDING : PO submits registration form
    PENDING --> APPROVED : PO approves and invites(trial/permanent, credits) | sends invite
    PENDING --> REJECTED : PO rejects request
    APPROVED --> CONFIRMATION_PENDING : user clicks invitation link | sends registration link
    CONFIRMATION_PENDING --> ACTIVE: user agrees and clicks registration link
    ACTIVE --> DELETED: user request delete
    ACTIVE --> BANNED: PO banns    
    BANNED --> ACTIVE: PO reactivates
    DELETED --> ACTIVE: PO reactivates
Loading

Highlights

  • Controller layer _users_rest implements
    • Admin view of users: GET /admin/user-accounts(pagination, account_request_status) -> Page[UserForAdminGet]
    • Action to approve a pre-registered user: POST /admin/user-accounts:approve(email) -> 204
    • Action to reject a pre-registered user: POST /admin/user-accounts:reject(email) -> 204
  • Service layer _users_service implments
    • list_all_user_accounts: list admin-view of user accounts that includes merged pre- and registered users as well as all the products the user is.
    • search_users_accounts: updates models
    • approve_user_account, reject_user_account
  • Repository layer _users_repository implements
    • operations on pre-registration
      • standard: create_user_pre_registration
      • standard: list_user_pre_registrations
      • custom: review_user_pre_registration
    • operations on merge pre-registration + users (registered)
      • standard: list_merged_pre_and_registered_users
      • custom search_merged_pre_and_registered_users

Related issue/s

How to test

  • setup product.login_settings={"LOGIN_2FA_REQUIRED": false, "LOGIN_REGISTRATION_INVITATION_REQUIRED": true, "LOGIN_REGISTRATION_CONFIRMATION_REQUIRED": true}
  • add a couple of registrations
  • login as PO
  • list them using the swagger (/dev/doc) entrypoint or view the PO center search
    image

Here some views of the front-end prototype
image

image

Dev-ops

None

@pcrespov pcrespov self-assigned this Apr 22, 2025
@codecov
Copy link

codecov bot commented Apr 22, 2025

Codecov Report

Attention: Patch coverage is 85.04673% with 32 lines in your changes missing coverage. Please review.

Project coverage is 88.87%. Comparing base (532f8eb) to head (9dda27d).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7560      +/-   ##
==========================================
+ Coverage   87.39%   88.87%   +1.48%     
==========================================
  Files        1838     1465     -373     
  Lines       71160    60673   -10487     
  Branches     1201      474     -727     
==========================================
- Hits        62187    53923    -8264     
+ Misses       8643     6630    -2013     
+ Partials      330      120     -210     
Flag Coverage Δ
integrationtests 64.29% <25.77%> (-0.33%) ⬇️
unittests 87.98% <85.04%> (+1.38%) ⬆️
Components Coverage Δ
api 76.84% <ø> (ø)
pkg_aws_library ∅ <ø> (∅)
pkg_dask_task_models_library ∅ <ø> (∅)
pkg_models_library 93.11% <100.00%> (+0.01%) ⬆️
pkg_notifications_library ∅ <ø> (∅)
pkg_postgres_database ∅ <ø> (∅)
pkg_service_integration 69.92% <ø> (ø)
pkg_service_library ∅ <ø> (∅)
pkg_settings_library ∅ <ø> (∅)
pkg_simcore_sdk 85.13% <ø> (+0.05%) ⬆️
agent 96.46% <ø> (ø)
api_server 91.58% <ø> (ø)
autoscaling 96.07% <ø> (ø)
catalog 92.29% <ø> (ø)
clusters_keeper 99.25% <ø> (ø)
dask_sidecar 91.67% <ø> (ø)
datcore_adapter 98.12% <ø> (ø)
director 76.87% <ø> (+0.09%) ⬆️
director_v2 91.00% <ø> (-0.13%) ⬇️
dynamic_scheduler 96.76% <ø> (ø)
dynamic_sidecar 90.18% <ø> (ø)
efs_guardian 89.79% <ø> (ø)
invitations 93.28% <ø> (ø)
payments 92.63% <ø> (ø)
resource_usage_tracker 89.02% <ø> (-0.11%) ⬇️
storage 87.49% <ø> (ø)
webclient ∅ <ø> (∅)
webserver 85.69% <83.50%> (-0.05%) ⬇️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 532f8eb...9dda27d. Read the comment docs.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@pcrespov pcrespov changed the title WIP: Is23/web api list users for admin WIP: Is23/web api list account requests and users for PO center Apr 23, 2025
@pcrespov pcrespov added this to the Pauwel Kwak milestone Apr 23, 2025
@pcrespov pcrespov added the a:webserver webserver's codebase. Assigning the area is particularly useful for bugs label Apr 23, 2025
@pcrespov pcrespov modified the milestones: Pauwel Kwak, Bazinga! May 19, 2025
@pcrespov pcrespov force-pushed the is23/web-api-list-users-for-admin branch from 998c81c to de7bd73 Compare May 19, 2025 13:58
@pcrespov pcrespov marked this pull request as ready for review May 22, 2025 14:55
Copy link
Member

@odeimaiz odeimaiz left a comment

Choose a reason for hiding this comment

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

the js part lgtm

@pcrespov pcrespov force-pushed the is23/web-api-list-users-for-admin branch from 2e9c48f to 14beb76 Compare May 22, 2025 17:06
@pcrespov pcrespov enabled auto-merge (squash) May 22, 2025 17:08
@pcrespov pcrespov requested a review from bisgaard-itis May 22, 2025 17:09
Copy link
Member

@sanderegg sanderegg left a comment

Choose a reason for hiding this comment

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

cool!

@pcrespov pcrespov added the 🤖-automerge marks PR as ready to be merged for Mergify label May 22, 2025
@sonarqubecloud
Copy link

@pcrespov pcrespov merged commit 89f3caf into ITISFoundation:master May 22, 2025
92 of 95 checks passed
@pcrespov pcrespov deleted the is23/web-api-list-users-for-admin branch May 23, 2025 08:31
@matusdrobuliak66 matusdrobuliak66 mentioned this pull request Jun 6, 2025
92 tasks
@matusdrobuliak66 matusdrobuliak66 mentioned this pull request Aug 5, 2025
88 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🤖-automerge marks PR as ready to be merged for Mergify a:frontend issue affecting the front-end (area group) a:webserver webserver's codebase. Assigning the area is particularly useful for bugs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants