Skip to content

Conversation

@pcrespov
Copy link
Member

@pcrespov pcrespov commented May 2, 2025

What do these changes do?

Script to assist in users pre-registration

Examples of usage:

   uv run pre_registration.py --help       
                                                                                                                                                                                         
 Usage: pre_registration.py [OPTIONS] COMMAND [ARGS]...                                                                                                                                  
                                                                                                                                                                                         
 User management utilities for osparc-simcore                                                                                                                                            
                                                                                                                                                                                         
                                                                                                                                                                                         
╭─ Options ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ --install-completion          Install completion for the current shell.                                                                                                               │
│ --show-completion             Show completion for the current shell, to copy it or customize the installation.                                                                        │
│ --help                        Show this message and exit.                                                                                                                             │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ pre-register   Pre-register users from a JSON file.                                                                                                                                   │
│ invite         Generate an invitation link for a guest email.                                                                                                                         │
│ invite-all     Generate invitation links for multiple users from a JSON file.                                                                                                         │
╰──────────────────────────────────────────────────────────────────────────────────
uv run pre_registration.py pre-register --help 
                                                                                                                                                                                         
 Usage: pre_registration.py pre-register [OPTIONS] USERS_FILE                                                                                                                            
                                                                                                                                                                                         
 Pre-register users from a JSON file.                                                                                                                                                    
                                                                                                                                                                                         
 The JSON file should contain a list of user objects with the following fields: firstName, lastName, email, and optionally institution, phone, address, city, state, postalCode,         
 country.                                                                                                                                                                                
                                                                                                                                                                                         
╭─ Arguments ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ *    users_file      PATH  Path to JSON file containing user data to pre-register [default: None] [required]                                                                          │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Options ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ --base-url  -u      TEXT  Base URL of the API [default: http://localhost:8001]                                                                                                        │
│ --email     -e      TEXT  Admin email for login [default: None]                                                                                                                       │
│ --password  -p      TEXT  Admin password for login [default: None]                                                                                                                    │
│ --help                    Show this message and exit.                                                                                                                                 │
╰────────────────────────────────────────────────
uv run pre_registration.py invite --help       
                                                                                                                                                                                         
 Usage: pre_registration.py invite [OPTIONS] GUEST_EMAIL                                                                                                                                 
                                                                                                                                                                                         
 Generate an invitation link for a guest email.                                                                                                                                          
                                                                                                                                                                                         
                                                                                                                                                                                         
╭─ Arguments ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ *    guest_email      TEXT  Email address of the guest to invite [default: None] [required]                                                                                           │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Options ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ --trial-days     -t      INTEGER  Number of days for trial account [default: None]                                                                                                    │
│ --extra-credits  -c      INTEGER  Extra credits in USD (0-499) [default: None]                                                                                                        │
│ --base-url       -u      TEXT     Base URL of the API [default: http://localhost:8001]                                                                                                │
│ --email          -e      TEXT     Admin email for login [default: None]                                                                                                               │
│ --password       -p      TEXT     Admin password for login [default: None]                                                                                                            │
│ --help                            Show this message and exit.                                                                                                                         │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
uv run pre_registration.py invite-all --help 
                                                                                                                                                                                         
 Usage: pre_registration.py invite-all [OPTIONS] EMAILS_FILE                                                                                                                             
                                                                                                                                                                                         
 Generate invitation links for multiple users from a JSON file.                                                                                                                          
                                                                                                                                                                                         
 The JSON file should contain either: 1. A list of email strings: ["[email protected]", "[email protected]"] 2. A list of objects with an email property: [{"email":                     
 "[email protected]", ...}, ...]                                                                                                                                                         
                                                                                                                                                                                         
╭─ Arguments ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ *    emails_file      PATH  Path to JSON file containing emails to invite [default: None] [required]                                                                                  │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Options ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ --trial-days     -t      INTEGER  Number of days for trial account [default: None]                                                                                                    │
│ --extra-credits  -c      INTEGER  Extra credits in USD (0-499) [default: None]                                                                                                        │
│ --base-url       -u      TEXT     Base URL of the API [default: http://localhost:8001]                                                                                                │
│ --email          -e      TEXT     Admin email for login [default: None]                                                                                                               │
│ --password       -p      TEXT     Admin password for login [default: None]                                                                                                            │
│ --help                            Show this message and exit.                                                                                                                         │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

Related issue/s

How to test

  • Run uv run pre_registration.py pre-register against master and check user_pre_registration table
  • Created ~30 pre-registrations

Dev-ops

@pcrespov pcrespov added the t:maintenance Some planned maintenance work label May 2, 2025
@pcrespov pcrespov added this to the Pauwel Kwak milestone May 2, 2025
@pcrespov pcrespov self-assigned this May 2, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.

@pcrespov pcrespov changed the title 🔨 Maintenance: script for pre-registration 🔨 Maintenance: script to assist bulk pre-registrations May 2, 2025
@pcrespov pcrespov enabled auto-merge (squash) May 2, 2025 12:58
Copy link
Collaborator

@matusdrobuliak66 matusdrobuliak66 left a comment

Choose a reason for hiding this comment

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

Beautiful

@eofli
Copy link

eofli commented May 2, 2025

Thank you all – this helped me a lot..

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.

nice! you can use uvx which is a shortcut for uv run

@pcrespov
Copy link
Member Author

pcrespov commented May 2, 2025

@mergify queue

@mergify
Copy link
Contributor

mergify bot commented May 2, 2025

queue

🟠 Waiting for conditions to match

  • -closed [📌 queue requirement]
  • any of: [🔀 queue conditions]
    • all of: [📌 queue conditions of queue default]
      • any of: [🛡 GitHub branch protection]
        • check-neutral = build-test-images (frontend) / build-test-images
        • check-skipped = build-test-images (frontend) / build-test-images
        • check-success = build-test-images (frontend) / build-test-images
      • #approved-reviews-by >= 2 [🛡 GitHub branch protection]
      • #approved-reviews-by>=2
      • #changes-requested-reviews-by = 0 [🛡 GitHub branch protection]
      • #changes-requested-reviews-by=0
      • #review-threads-unresolved = 0 [🛡 GitHub branch protection]
      • #review-threads-unresolved=0
      • -conflict
      • -draft
      • base=master
      • branch-protection-review-decision = APPROVED [🛡 GitHub branch protection]
      • label!=🤖-do-not-merge
      • label=🤖-automerge
      • any of: [🛡 GitHub branch protection]
        • check-skipped = deploy to dockerhub
        • check-neutral = deploy to dockerhub
        • check-success = deploy to dockerhub
      • any of: [🛡 GitHub branch protection]
        • check-success = system-tests
        • check-neutral = system-tests
        • check-skipped = system-tests
      • any of: [🛡 GitHub branch protection]
        • check-success = unit-tests
        • check-neutral = unit-tests
        • check-skipped = unit-tests
      • any of: [🛡 GitHub branch protection]
        • check-success = check OAS' are up to date
        • check-neutral = check OAS' are up to date
        • check-skipped = check OAS' are up to date
      • any of: [🛡 GitHub branch protection]
        • check-success = integration-tests
        • check-neutral = integration-tests
        • check-skipped = integration-tests
  • -conflict [📌 queue requirement]
  • -draft [📌 queue requirement]
  • any of: [📌 queue -> configuration change requirements]
    • -mergify-configuration-changed
    • check-success = Configuration changed

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

sonarqubecloud bot commented May 5, 2025

@pcrespov pcrespov disabled auto-merge May 5, 2025 11:23
@pcrespov pcrespov merged commit 885d028 into ITISFoundation:master May 5, 2025
58 checks passed
@pcrespov pcrespov deleted the mai/invitations-scripts branch May 5, 2025 11:23
@matusdrobuliak66 matusdrobuliak66 mentioned this pull request May 8, 2025
34 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 t:maintenance Some planned maintenance work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants