aboutsummaryrefslogtreecommitdiff
path: root/gn3/auth
AgeCommit message (Collapse)Author
2023-06-20Fix conflictszsloan
2023-06-20Bug: Don't overwrite/delete old collectionsFrederick Muriuki Muriithi
2023-06-13Namespace session variableFrederick Muriuki Muriithi
Extract the functions acting on the session into a separate module and namespace the session variable to prevent conflicts.
2023-06-08Fix bugs with accessing/creating collectionszsloan
2023-06-05Logging: Don't allow getting user info to stop application startingFrederick Muriuki Muriithi
In certain scenarios (probably due to host contamination) the effective UID of the running application is not the expected "genenetwork" user, rather, it is a user on the host system, which leads to the error: KeyError: 'getpwuid(): uid not found: 1000' This commit prevents the application from failing in such a case, but still logs out such weirdness.
2023-06-05Logging: Get user information.Frederick Muriuki Muriithi
2023-06-05Handle unhandled SQLite3 errors.Frederick Muriuki Muriithi
2023-05-30auth: Change check for client secretFrederick Muriuki Muriithi
We are saving the client secret in an encrypted form, meaning we have to verify that the CLIENT_SECRET that is provided is the same one as was generated at registration in a different way. Initially, I was doing a direct comparison, having saved the CLIENT_SECRET value as unencrypted plain-text.
2023-05-29auth: Enable registration of OAuth2 clientsFrederick Muriuki Muriithi
Add UI and code to enable the administrative user to register new OAuth2 clients that can access the API server.
2023-05-29Enable Administrator login on GN3Frederick Muriuki Muriithi
* gn3/auth/authentication/oauth2/views.py: Remove endpoint * gn3/auth/authorisation/users/admin/__init__.py: New admin module * gn3/auth/authorisation/users/admin/ui.py: New admin module * gn3/auth/authorisation/users/admin/views.py: New admin module * gn3/auth/views.py: Use new admin module * gn3/errors.py: Fix linting errors * gn3/templates/login.html: New html template * main.py: Fix linting errors
2023-05-27Document Use of OAuth2 ClientsFrederick Muriuki Muriithi
* docs/authentication_and_authorisation/oauth2_clients.md: New documentation * gn3/auth/authentication/oauth2/server.py: Raise appropriate error if no client is found. * gn3/auth/authentication/oauth2/views.py: Handle exception in the case where a UI should be presented to the user, rather than presenting the raw JSON response to the user. * gn3/errors.py: Handle any authlib OAuth2Error at the application's top-level * gn3/templates/oauth2/oauth2_error.html: Handle any authlib OAuth2Error at the application's top-level
2023-05-25Script to assign existing data to publicly-visible resourcesFrederick Muriuki Muriithi
A script to assign existing data not assigned to any group to publicly-visible resources.
2023-05-25Set whether resource is publicly viewable on creationFrederick Muriuki Muriithi
2023-05-23auth: Enable user masqueradeFrederick Muriuki Muriithi
Enable users with the appropriate privileges to masquerade as other users by providing an endpoint that provides a new token for the "masqueradee"
2023-05-19auth: Provide user and resource info in the trait dataFrederick Muriuki Muriithi
Provide the user and resource_id information in each trait's authorisation details to help with linking on the UI end.
2023-05-19auth: Check for json on authorisation endpoint. Add user data.Frederick Muriuki Muriithi
Ensure the authorisation endpoint expects only JSON. Add the user data to the response from the endpoint.
2023-05-18auth: Rename collectionsFrederick Muriuki Muriithi
Enable renaming collections.
2023-05-18auth: user collections: Add and/or remove traits.Frederick Muriuki Muriithi
2023-05-17auth: Delete collections by ID.Frederick Muriuki Muriithi
2023-05-17auth: Import/Delete Anonymous CollectionsFrederick Muriuki Muriithi
Add code to enable the importation/deletion of anonymous collections in the active session to the authenticated user's collections.
2023-05-16auth: View a collection by its ID.Frederick Muriuki Muriithi
2023-05-15collections: Move code to new package. Create new collections.Frederick Muriuki Muriithi
Move the code to a new package. Enable the creation of new collection by both authenticated and anonymous users.
2023-05-12auth: Provide separate endpoint for anonymous collections.Frederick Muriuki Muriithi
2023-05-11auth: Fix bug with migration of user collectionsFrederick Muriuki Muriithi
The code, as written previously had a subtle bug - if the user created a new collection before they had tried accessing their list of collections, the older code would not have migrated the older collections. This commit fixes that by enabling the migration of older collections, whether or not the user has created a collection with their new accounts.
2023-05-10auth: Add the /oauth2/user/collections/list endpointFrederick Muriuki Muriithi
Add an endpoint to list a user's collections. This only works for logged in users.
2023-05-10auth: Only check deliverability of emails at registration.Frederick Muriuki Muriithi
Check only that the email format is correct, but don't bother with the deliverability check during authentication. The deliverability check is done at registration.
2023-05-09auth: Implement "Authorization Code Flow"auth/implement-authorization-code-flowFrederick Muriuki Muriithi
Implement the "Authorization Code Flow" for the authentication of users. * gn3/auth/authentication/oauth2/grants/authorisation_code_grant.py: query and save the authorisation code. * gn3/auth/authentication/oauth2/models/authorization_code.py: Implement the `AuthorisationCode` model * gn3/auth/authentication/oauth2/models/oauth2client.py: Fix typo * gn3/auth/authentication/oauth2/server.py: Register the `AuthorisationCodeGrant` grant with the server. * gn3/auth/authentication/oauth2/views.py: Implement `/authorise` endpoint * gn3/templates/base.html: New HTML Templates of authorisation UI * gn3/templates/common-macros.html: New HTML Templates of authorisation UI * gn3/templates/oauth2/authorise-user.html: New HTML Templates of authorisation UI * main.py: Allow both "code" and "token" response types.
2023-04-27auth: Retrieve `system:*` privileges from resource rolesFrederick Muriuki Muriithi
With the assignment of `system:*` privileges to roles, we need to check for their existence when doing authorisation. This commit provides a hack for that, seeing as user groups (and the system itself) are not treated as resources, and therefore the way to fetch the privileges is not entirely consistent.
2023-04-27auth: List also the non-resource privileges the user hasFrederick Muriuki Muriithi
While creating new group roles, enable the listing of non-resource privileges, e.g. `system:group:*` and `system:user:*` that the user has to allow for them to be used in role creation.
2023-04-27auth: Add authorisation checks for role editting.Frederick Muriuki Muriithi
2023-04-27oauth2: Provide missing `user_editable` argument.Frederick Muriuki Muriithi
2023-04-25auth: bug: Provide missing `user_editable` argument.Frederick Muriuki Muriithi
2023-04-25auth: provide `user_editable` flag in dictified outputFrederick Muriuki Muriithi
2023-04-25auth: Roles: Check for editabilityFrederick Muriuki Muriithi
Some roles should not be user-editable, and as such, we need to check before allowing any edits on such roles. This commit makes that possible.
2023-04-24auth: Return the actual privileges for the userFrederick Muriuki Muriithi
Previously, the `oauth2/data/authorisation` endpoint was returning hard-coded values for the privileges assigned to the user for each resource. In this change, we rework to return the actual privileges for the user.
2023-04-21auth: Attach linked data to specific resources.Frederick Muriuki Muriithi
2023-04-21auth: Fetch user group phenotypes not attached to a resource.Frederick Muriuki Muriithi
2023-04-19oauth2: Link the phenotype traits to user groups.Frederick Muriuki Muriithi
2023-04-19Fix minor linting and typing issuesFrederick Muriuki Muriithi
2023-04-19auth: Setup selected traits correctlyFrederick Muriuki Muriithi
Fix bugs with setting up of the selected traits for use while filtering the search results.
2023-04-19auth: phenotypes - provide default empty list for selected traits.Frederick Muriuki Muriithi
2023-04-18auth: Pass `--per-page` and `--selected` options.Frederick Muriuki Muriithi
2023-04-17Hook up code to use external search script for phenotypesFrederick Muriuki Muriithi
2023-04-17auth: Delete code that is no longer usedFrederick Muriuki Muriithi
2023-04-15Decouple `gn3.db_utils` from `flask.current_app`.Frederick Muriuki Muriithi
Decouple the `gn3.db_utils` module from the global `flask.current_app` object, ensuring that the database uri value is passed in as a required argument to the `gn3.db_utils.database_connection` function.
2023-04-14auth: Add external script to search for phenotypesFrederick Muriuki Muriithi
We need a search through the available phenotype traits in the database when linking the traits to user groups. Unfortunately, the Xapian Search indexes do not (and should not) include the internal identifiers we use to disambiguate the traits. On the other hand, we do not want to present the user with traits that have already been linked to any user group within the search results. The script in this commit, together with the modified queries for fetching the phenotype data form a "hack" of sorts to wrap around the way the search works while ensuring we do not present the user with "non-actionable" (linked) traits in the search results.
2023-04-14auth: Disconnect module from flask applicationFrederick Muriuki Muriithi
To avoid application context errors in external scripts, disconnect the `gn3.auth.db` module from the `flask.current_app` dependency.
2023-04-12auth: Enable listing of unlinked genotype/mRNA group data.Frederick Muriuki Muriithi
2023-04-10Add search and link for mRNA Assay datasets.Frederick Muriuki Muriithi
2023-04-10Update expected request key.Frederick Muriuki Muriithi