| Age | Commit message (Collapse) | Author |
|
Use gn-libs' can_create_or_delete_user() + user_roles_on_system() for the
privilege check in delete_users(), matching the pattern already used by
create_user().
Removes the authorised_for2, system_resource, and AuthorisationError
imports that are no longer needed.
Reviewed-By: Frederick M. Muriithi <fredmanglis@gmail.com>
|
|
Move POST /auth/user/delete to POST /auth/system/administration/users/delete,
consistent with the create endpoint already living there.
gn_auth/auth/system/admin/users.py:
- Add imports for sqlite3, reduce, Sequence, AuthorisationError,
authorised_for2, and system_resource.
- Move __delete_users_individually__, __fetch_non_deletable_users__,
__non_deletable_with_reason__, and delete_users() from users/views.py.
gn_auth/auth/authorisation/users/views.py:
- Remove the four functions moved to admin/users.py.
The sole known caller (GN2 wqflask/oauth2/users.py) is updated in the
accompanying genenetwork2 patch.
Reviewed-By: Frederick M. Muriithi <fredmanglis@gmail.com>
|
|
Move the user-creation endpoint from gn_auth/auth/authorisation/users/views.py
into the new sysadmin package at gn_auth/auth/system/admin/users.py.
New URL: POST /auth/system/administration/users/create
Old URL: POST /auth/user/create now issues a 308 Permanent Redirect.
The admin blueprint is updated to register the new users blueprint at /users.
Reviewed-By: Frederick M. Muriithi <fredmanglis@gmail.com>
|
|
The system-administrator role carries system:resource:assign-owner
(migration 20250729_02), but no endpoint used it. Sysadmins had no API
path to bootstrap ownership on a resource that has no owner yet.
Implement two endpoints in gn_auth/auth/system/admin/resources.py
(the blueprint skeleton was already wired in a preceding commit):
POST /auth/system/administration/resources/<resource_id>/assign-owner
Body: {"user_id": "<uuid>"}
Assigns the resource-owner role to the named user on the resource.
POST /auth/system/administration/resources/<resource_id>/revoke-owner
Body: {"user_id": "<uuid>"}
Revokes the resource-owner role from the named user on the resource.
Both check system:resource:assign-owner on the *system* resource, so a
sysadmin can grant/revoke ownership without being resource-owner
themselves.
Reviewed-By: Frederick M. Muriithi <fredmanglis@gmail.com>
|
|
|