Skip to content

Commit

Permalink
Actually implement staff field in Level4AuthenticatedUser
Browse files Browse the repository at this point in the history
This existed, and had some test set up, but was not actually set. We're
about to store user data in a persistant way in airlock, so it would be
good to have this for that purpose.
  • Loading branch information
bloodearnest committed Feb 6, 2025
1 parent 10ea6cd commit cd00a2f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions jobserver/api/releases.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,13 @@
from interactive.slacks import notify_report_uploaded
from jobserver import releases, slacks
from jobserver.api.authentication import get_backend_from_token
from jobserver.authorization import OutputChecker, has_permission, has_role, permissions
from jobserver.authorization import (
OutputChecker,
StaffAreaAdministrator,
has_permission,
has_role,
permissions,
)
from jobserver.commands import users
from jobserver.models import (
Project,
Expand Down Expand Up @@ -621,7 +627,7 @@ def build_level4_user(user):
# list the explicit workspaces that the user has this permission
# for.
output_checker=has_role(user, OutputChecker),
staff=False,
staff=has_role(user, StaffAreaAdministrator),
)
)
assert level4_user.is_valid(), level4_user.errors
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/jobserver/api/test_releases.py
Original file line number Diff line number Diff line change
Expand Up @@ -1813,7 +1813,7 @@ def test_level4tokenauthenticationapi_success_privileged(
}, # should not include workspace3
"copiloted_workspaces": {},
"output_checker": True,
"staff": False,
"staff": True,
}


Expand Down

0 comments on commit cd00a2f

Please sign in to comment.