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

User Zero / Super Admin #1021

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

User Zero / Super Admin #1021

wants to merge 5 commits into from

Conversation

ArneTR
Copy link
Member

@ArneTR ArneTR commented Dec 17, 2024

Added user-0 functionality and super_admin functionality

  • User 0 will be set if systems jobs are running like sending mail or running measurement control workloads
  • Super admin is a functionality to be able to see data from other users. This is controlled through the ACL lists in the DB

TBD:

  • By default users should only see own data (User 1 is default user)

Greptile Summary

Implements user-0 system account and super admin functionality, adding proper user attribution and access control for system operations and cross-user data access.

  • Added is_super_admin() method in /lib/user.py to check admin capabilities
  • Created system user (ID 0) in /docker/structure.sql with restricted permissions for system operations
  • Added migration script /migrations/2024_12_17_user_zero.sql to create user-0 and update existing records
  • Modified database schema to enforce user_id NOT NULL constraints with ON DELETE RESTRICT
  • Updated tests to include proper user attribution in test data creation

💡 (4/5) You can add custom instructions or style guidelines for the bot here!

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

This PR introduces user-0 functionality and super admin capabilities to improve system job attribution and access control management.

  • Added system user (ID 0) with restricted permissions for handling system operations like error emails and control workload measurements
  • Introduced is_super_admin() capability check in lib/user.py for controlling data access across users
  • Modified database schema to enforce user_id NOT NULL constraints in jobs/runs tables with proper foreign key relationships
  • Added migration script to create user-0 and update existing records with appropriate user associations
  • Changed default user ID from None to 1 across the codebase for proper user attribution

💡 (4/5) You can add custom instructions or style guidelines for the bot here!

7 file(s) reviewed, 9 comment(s)
Edit PR Review Bot Settings | Greptile

lib/error_helpers.py Show resolved Hide resolved
docker/structure.sql Outdated Show resolved Hide resolved
docker/structure.sql Outdated Show resolved Hide resolved
docker/structure.sql Outdated Show resolved Hide resolved
lib/user.py Show resolved Hide resolved
migrations/2024_12_17_user_zero.sql Outdated Show resolved Hide resolved
migrations/2024_12_17_user_zero.sql Show resolved Hide resolved
migrations/2024_12_17_user_zero.sql Show resolved Hide resolved
runner.py Show resolved Hide resolved
* main:
  Clickable Comparsion Charts + Display Missing Values (#1017)
  Bump uvicorn[standard] from 0.32.1 to 0.34.0 (#1019)
  Bump playwright/python in /docker/auxiliary-containers/gcb_playwright (#1018)
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

LGTM

8 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

LGTM

2 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile

Copy link

Eco-CI Output:

Label 🖥 avg. CPU utilization [%] 🔋 Total Energy [Joules] 🔌 avg. Power [Watts] Duration [Seconds]
Total Run (incl. overhead) 25.3446 3115.56 3.98 781.88
Measurement #1 25.3182 3115.56 4.00 779.58

🌳 CO2 Data:
City: San Jose, Lat: 37.1835, Lon: -121.7714
IP: 52.234.46.114
CO₂ from energy is: 0.585725280 g
CO₂ from manufacturing (embodied carbon) is: 0.223081160 g
Carbon Intensity for this location: 188 gCO₂eq/kWh
SCI: 0.808806 gCO₂eq / pipeline run emitted

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.

1 participant