about summary refs log tree commit diff
path: root/gn_auth/auth/authorisation/resources
AgeCommit message (Collapse)Author
14 daysrefactor(system/views): remove dead deprecation-check code HEAD mainClaude Sonnet 4.6
The /auth/system/roles endpoint has no active blueprint registration — the system Blueprint is only reachable via /auth/resource/system/roles. The `if "/resource/" not in request.path` branch could never fire, so remove it along with _SUCCESSOR, and the warnings import. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Reviewed-By: Frederick M. Muriithi <fredmanglis@gmail.com>
2026-09-01Bugfix: Use correct spec strings.Frederick Muriuki Muriithi
These bugs were introduced by Claude, and I missed them during review.
2026-09-01fix(auth): check system:user:list against system resource in resource_usersClaude
The HACK block in resource_users() was checking the system:user:list privilege against the requested resource_id rather than the system resource. This made the sysadmin branch a dead leg: sysadmins hold system:user:list on the system resource, not on individual data resources. Fix: pass system_resource(conn).resource_id for the system-level check. Also restructure to early-return on auth failure (cleaner control flow). Reviewed-By: Frederick M. Muriithi <fredmanglis@gmail.com>
2026-09-01refactor(auth): remove deprecated authorised_for and authorised_for2Claude
All callers have been migrated to authorised_for_spec (previous commit). Remove the two deprecated functions and their now-orphaned helpers: - authorised_for() and authorised_for2() deleted - __organise_privileges_by_resource_id__() deleted (only used by authorised_for) - Orphaned imports removed: reduce, Sequence, Resource, User, db_row_to_privilege Reviewed-By: Frederick M. Muriithi <fredmanglis@gmail.com>
2026-09-01refactor(auth): migrate authorised_for/2 -> authorised_for_specClaude
Replace all uses of the deprecated authorised_for() and authorised_for2() helpers with authorised_for_spec() across resources/views.py and data/phenotypes.py. - resources/views.py (resource_users HACK block): two authorised_for() calls replaced; the intermediate dict merge collapsed into a plain boolean since authorised_for_spec returns bool directly. - resources/views.py (assign_role_to_user, unassign_role_to_user): authorised_for() was called but its return value was discarded, making the check a silent no-op. Now replaced with authorised_for_spec() and a proper if/raise guard. Also fixes a typo: the privilege string was "resource:role:assign-role" (non-existent); corrected to the real privilege "resource:user:assign-role". - resources/views.py (unassign_resource_role_privilege): direct replacement; intermediate _authorised variable removed. - data/phenotypes.py (link_phenotype_data): two authorised_for2() calls replaced; .resource_id extracted from the Resource objects to satisfy authorised_for_spec's UUID argument. User type annotation added. Reivewed-By: Frederick M. Muriithi <fredmanglis@gmail.com>
2026-08-31Use `gn_libs.sqlite3 instead of deprecated `gn_auth.auth.db.sqlite3`.Frederick Muriuki Muriithi
2026-08-31feat(system/roles): add Deprecation header on old pathClaude
GET /auth/system/roles is superseded by GET /auth/resource/system/roles, which has been live since the system Blueprint was registered under the resources Blueprint. Add Deprecation: true and a Link successor-version header when the endpoint is reached via the old path, so callers can discover the new URL. The old registration in auth/views.py already carries a TODO noting it should be removed once consumers are updated. Callers to migrate: - GN2: wqflask/views.py, metadata_edits.py (×3), flask_extensions.py, oauth2/ui.py, oauth2/request_utils.py, oauth2/resources.py (×2) - GN3: gn3/api/metadata.py, gn3/api/case_attributes.py - gn-integration-tests: tests/test_gn_auth_smoke.py Reviewed-By: Frederick M. Muriithi <fredmanglis@gmail.com>
2026-08-28Add package for administrative endpoints.Frederick Muriuki Muriithi
2026-08-27Cleanup deprecation warnings: Switch to gn_libs.sqlite3Frederick Muriuki Muriithi
The gn_auth.auth.db.sqlite3 module is deprecated and should be removed. This cleanup goes a ways towards that goal.
2026-08-27Deprecate endpoint /auth/resources/<uuid:resource_id>/user/unassign.Frederick Muriuki Muriithi
Prefer the endpoint `/auth/users/<uuid:user_id/roles/revoke` that conforms to the Subject-Verb-Object paradigm, i.e. Revoke from a user (subject), the specified role acting on the specified resource (object) -- revoke a role would be the 'Verb'.
2026-08-27Deprecate endpoint /auth/resources/<uuid:resource_id>/user/assign.Frederick Muriuki Muriithi
2026-08-26Lint: Remove unused code and import.Frederick Muriuki Muriithi
2026-08-19Remove `grant_access_to_sysadmins()` function.Frederick Muriuki Muriithi
The "system-administrator" role acts at the system level and should not be granted against a non-system resource. This function is therefore a bug in its entirety and thus needed to go.
2026-05-21Deprecate functions which duplicate those in gn-libs.Frederick Muriuki Muriithi
The `gn_auth.auth.authorisation.resources.checks.can_[edit/delete]` functions duplicate the utility provided by similar named functions in the `gn_libs.privileges.resources` package. These ones are, thus, deprecated in favour of the gn-libs ones.
2026-05-21Delete unused function.Frederick Muriuki Muriithi
The `gn_auth.auth.authorisation.resources.checks.can_view` function is no longer used in this code base. It can be safely removed.
2026-05-18Update call to `can_edit` to separate resource and system privilegesFrederick Muriuki Muriithi
2026-05-01Ensure ALL users with access to the resource are actually listed.Frederick Muriuki Muriithi
2026-04-23Remove debug artifact.Frederick Muriuki Muriithi
2026-04-23Improve error messages.Frederick Muriuki Muriithi
2026-04-23Fix minor linting bugs.Frederick Muriuki Muriithi
2026-04-23Allow anonymous users "public-view" privileges.Frederick Muriuki Muriithi
The default system-level privilege is the "public-view", i.e. the users can view basic details about the Genenetwork system. If no authorisation is provided when accessing the /auth/system/roles endpoint, return the default role/privilege.
2026-04-20Implement editing resource name.Frederick Muriuki Muriithi
2026-04-20Use module-level logger rather than application's logger.Frederick Muriuki Muriithi
2026-04-15Do not grant sysadmins direct access at resource creation.Frederick Muriuki Muriithi
2026-04-08user resources: Add a text filter for further filtering.Frederick Muriuki Muriithi
2026-04-08user resources: return total with filtered records.Frederick Muriuki Muriithi
Return a count of the total number of resources that the user has access to even if we are only interested in a few of the records.
2026-04-07Update code to handle resource creators and creation times.Frederick Muriuki Muriithi
2026-04-07Add creator and creation time tracking to Resources.Frederick Muriuki Muriithi
2026-04-02Update resource creation: Add tracking informationFrederick Muriuki Muriithi
Add the creator of the resource and the time the resource was created.
2026-03-26Update edit access: use more flexible 'can_edit(...)' function.Frederick Muriuki Muriithi
2026-02-10Bug: Fix import path.Frederick Muriuki Muriithi
2026-02-10Authorisation Check: New function to check user has edit access.Frederick Muriuki Muriithi
2026-02-10Authorisation Check: New function to check user has view access.Frederick Muriuki Muriithi
2026-02-10Use Auth function that checks for delete access.Frederick Muriuki Muriithi
2026-02-10Authorisation Check: New function to check user has delete access.Frederick Muriuki Muriithi
2026-02-06Replace hard-coded email check with check against privilegesFrederick Muriuki Muriithi
Fix the check: rather than using a hard-coded email to check for authorisation, we instead check against the privileges the user has on the resource, or whether they have global privileges allowing them to act on any data.
2025-12-29`system_resource(...)` function takes either connection or cursorFrederick Muriuki Muriithi
Refactor to allow the `gn_auth.auth.authorisation.resources.system.models.system_resource` function to take either a database connection or cursor and use that to retrieve the "system resource".
2025-12-29`create_resource(...)` function takes either connection or cursorFrederick Muriuki Muriithi
Refactor to allow the `gn_auth.auth.authorisation.resources.models.create_resource` function to take either a database connection or cursor to perform its tasks.
2025-12-03Improve error messaging.Frederick Muriuki Muriithi
2025-07-31Clean up data on group deletion.Frederick Muriuki Muriithi
2025-07-31Re-grant access to sysadmin, in case they're removed as group memberFrederick Muriuki Muriithi
2025-07-31Revoke roles a user has on group when they are removed as a member.Frederick Muriuki Muriithi
2025-07-31Check for data inconsistency.Frederick Muriuki Muriithi
2025-07-31Prevent error in case sysadmin user already has accessFrederick Muriuki Muriithi
In case any sysadmin user has access to the resource, we do not want the query failing for other sysadmins.
2025-07-31Grant sysadmins access to user group when its created.Frederick Muriuki Muriithi
2025-07-31Delete a group.Frederick Muriuki Muriithi
2025-07-31Break circular dependency - move utility function to module of use.Frederick Muriuki Muriithi
2025-07-31Add function to retrieve inbredset-group data.Frederick Muriuki Muriithi
2025-07-31Fix query to remove user from group.Frederick Muriuki Muriithi
2025-07-30Provide endpoint to remove a group member.Frederick Muriuki Muriithi