Age | Commit message (Expand) | Author |
2023-02-24 | auth: resources: Fix query for data not linked to resources | Frederick Muriuki Muriithi |
2023-02-24 | auth: resources: Fix queries loading resources data. | Frederick Muriuki Muriithi |
2023-02-24 | auth: resources: Link data to resources. | Frederick Muriuki Muriithi |
2023-02-23 | auth: Link data in MySQL to the groups (in SQLite)...In order for the group leaders (and other resource creators) to be able to
link data to the resources, the data needs to be first linked to the relevant
group.
This commit enables the system admin to link the data in MySQL to the groups.
| Frederick Muriuki Muriithi |
2023-02-22 | auth: List data not linked to any group. | Frederick Muriuki Muriithi |
2023-02-21 | auth: db: DEBUG: Output quer(y|ies) that were run. | Frederick Muriuki Muriithi |
2023-02-21 | auth: resources: Attach resource data and list unlinked data....Load the data that is attached to a particular resource together with the
resource.
List any unlinked data: useful when linking data to resources.
| Frederick Muriuki Muriithi |
2023-02-10 | Return empty tuple rather than Nothing...When user has no roles assigned, return an empty tuple rather than
pymonad.maybe.Nothing to ease maintenance.
| Frederick Muriuki Muriithi |
2023-02-09 | auth: Reject request to join a group....* gn3/auth/authorisation/groups/models.py: Modify function to either accept or
reject join requests.
* gn3/auth/authorisation/groups/views.py: Provide endpoint to reject join
requests.
* migrations/auth/20230207_01_r0bkZ-create-group-join-requests-table.py:
Prevent user from applying to join the same group more than once.
| Frederick Muriuki Muriithi |
2023-02-09 | auth: users: Check whether a user has an active join request. | Frederick Muriuki Muriithi |
2023-02-08 | auth: groups: handle join requests. | Frederick Muriuki Muriithi |
2023-02-07 | auth: groups: Enable users to request to join group. | Frederick Muriuki Muriithi |
2023-02-06 | auth: resource: Enable viewing the details of a resource. | Frederick Muriuki Muriithi |
2023-02-03 | auth: commit missing module. | Frederick Muriuki Muriithi |
2023-02-03 | oauth: enable resource creation | Frederick Muriuki Muriithi |
2023-02-03 | auth: tests: mock token acquisition. Fix minor bugs. | Frederick Muriuki Muriithi |
2023-02-02 | auth: Improve authorisation...Retrieve the token, and user in the authorisation decorator to enable checking
of privileges.
| Frederick Muriuki Muriithi |
2023-02-02 | auth: Reorganise modules/packages for easier dev and maintenance...Split the views/routes into separate modules each dealing with a narrower
scope of the application to aid in maintenance, and help with making the
development easier.
| Frederick Muriuki Muriithi |
2023-01-31 | auth: Retrieve group members. | Frederick Muriuki Muriithi |
2023-01-31 | auth: Remove the @authenticated_p decorator...The @authenticated_p decorator (and function), is an artifact of the original
development ideas and should be removed from use.
| Frederick Muriuki Muriithi |
2023-01-31 | auth: Set the token scope as a string, not a list...Setting the scope as a list of strings was leading to errors when attempting
to logout. This commit leaves the scope as a string to avoid the errors.
| Frederick Muriuki Muriithi |
2023-01-30 | auth: Do not treat not finding a group as an error...Stop treating not finding a group for a user as an error, since that is an
actual expected state in the system at some point. Rather, restore the use of
Maybe rather than using Either.
We can raise the NotFoundError at the API level rather than at database
retrival level.
| Frederick Muriuki Muriithi |
2023-01-30 | auth: API: retrieve resources | Frederick Muriuki Muriithi |
2023-01-30 | auth: groups: cleanup code...Refactor to use the `.either` method call in a cleaner way.
Rework the imports.
| Frederick Muriuki Muriithi |
2023-01-30 | auth: API: Retrieve a user's group...Add endpoint to retrieve the group in which the user is a member.
| Frederick Muriuki Muriithi |
2023-01-28 | auth: Enable retrieval of a role by id. | Frederick Muriuki Muriithi |
2023-01-28 | auth: rework dictify...Define a Protocol type to use with the `dictify` function and implement the
`dictify` methods for the various classes.
| Frederick Muriuki Muriithi |
2023-01-28 | auth: Store error_code in Exception for flexibility...To allow for different error codes for the various exceptions, store the
error_code in the exception objects and retrieve it from there when generating
the response.
| Frederick Muriuki Muriithi |
2023-01-23 | auth: Add missing module | Frederick Muriuki Muriithi |
2023-01-23 | auth: create group: Fix group creation....* gn3/auth/authorisation/checks.py: Enable passing user to authorisation
checking function. Raise error on authorisation failure for consistent error
handling.
* gn3/auth/authorisation/groups.py: Add user to group, updating the privileges
as appropriate.
* gn3/auth/authorisation/resources.py: Fix resources querying
* gn3/auth/authorisation/roles.py: Assign/revoke roles by name
* gn3/auth/authorisation/views.py: Create group
* migrations/auth/20221108_01_CoxYh-create-the-groups-table.py: Add
group_metadata field
* tests/unit/auth/fixtures/group_fixtures.py: fix tests
* tests/unit/auth/test_groups.py: fix tests
* tests/unit/auth/test_resources.py: fix tests
* tests/unit/auth/test_roles.py: fix tests
| Frederick Muriuki Muriithi |
2023-01-21 | auth: Groups - Fetch all existing groups | Frederick Muriuki Muriithi |
2023-01-21 | auth: Roles - Fix bug with role retrieval. | Frederick Muriuki Muriithi |
2023-01-21 | auth: Fix saving of scope values. Add scope items. | Frederick Muriuki Muriithi |
2023-01-20 | mypy: minor fixes to typing errors | Frederick Muriuki Muriithi |
2023-01-20 | auth: rename revocation endpoint | Frederick Muriuki Muriithi |
2023-01-20 | auth: Save token with update...If the token already exists, then update the details rather than trying to
insert.
| Frederick Muriuki Muriithi |
2023-01-20 | auth: Setup the user correctly...* gn3/auth/authentication/oauth2/grants/password_grant.py: Return user rather
than boolean
* gn3/auth/authentication/oauth2/models/oauth2client.py: provide optional
`user` argument to allow flexibility in setting up the client's user
* gn3/auth/authentication/oauth2/models/oauth2token.py: Set token and client
user correctly
* gn3/auth/authentication/oauth2/server.py: Set token user from the request
| Frederick Muriuki Muriithi |
2023-01-20 | auth: Add development utils/tools...To avoid having to manually rebuild some default data for exploration of
concepts while developing the system, add a way to build up the test users and
oauth2 clients to use for testing.
| Frederick Muriuki Muriithi |
2023-01-19 | auth: Fix user registration...The code checking for errors was buggy and would let empty values through.
The sqlite3.IntegrityError exception was not being handled correctly, and
would cause a failure in the application.
This commit fixes the issues noted above.
* gn3/auth/authorisation/roles.py: fix bug in generating query params
* gn3/auth/authorisation/views.py: fix error checking code. Raise exception if
email is already registered.
| Frederick Muriuki Muriithi |
2023-01-18 | auth: Enable FOREIGN KEY constraint for the connections...Enable the FOREIGN KEY constraints for the connections to the database to help
with queries that would otherwise lead to data corruption.
| Frederick Muriuki Muriithi |
2023-01-16 | auth: update privileges format...Save privileges with ids of the form <top-level>:<sub-level>:<privilege-name>
rather than using a UUID, to reduce indirection levels.
* migrations/auth/20230116_01_KwuJ3-rework-privileges-schema.py: new migration
to change the schema and IDs for the privileges.
* Update code to use new privileges format
* gn3/auth/authorisation/checks.py
* gn3/auth/authorisation/groups.py
* gn3/auth/authorisation/privileges.py
* gn3/auth/authorisation/resources.py
* gn3/auth/authorisation/roles.py
* migrations/auth/20230116_01_KwuJ3-rework-privileges-schema.py
* tests/unit/auth/fixtures/role_fixtures.py
* tests/unit/auth/test_groups.py
* tests/unit/auth/test_privileges.py
* tests/unit/auth/test_roles.py
| Frederick Muriuki Muriithi |
2023-01-11 | auth: assign default role. separate group creation from group admin...A newly registered user will have the ability to create a group.
Once a user is a member of a group, either by creating a new group, or being
added to a group, they should not be able to create any more groups, i.e. they
lose the 'create-group' (and/or equivalent) privileges.
This means that the group-administration privileges should be separated from
the group-creation privilege.
* gn3/auth/authorisation/roles.py: assign default roles to user on
registration
* gn3/auth/authorisation/views.py: assign default roles to user on
registration
* migrations/auth/20230111_01_Wd6IZ-remove-create-group-privilege-from-group-leader.py:
separate group-creation role from group-administration role.
* tests/unit/auth/fixtures/user_fixtures.py: Add group-creation role to test
user
* tests/unit/auth/test_roles.py: Add the group-creation role explicitly in the
expected results for the test
| Frederick Muriuki Muriithi |
2023-01-11 | auth: Add missing import | Frederick Muriuki Muriithi |
2023-01-05 | auth: Persist the user's registration details...If the registration details pass the validations steps, then persist the
details in the database and respond with details about the newly created user.
* gn3/auth/authentication/users.py: new functions
* `save_user`: create and persist a new user
* `set_user_password`: hash and persist the new password for the given user
* gn3/auth/authorisation/views.py: Persist the user details and respond with
the newly persisted user details.
| Frederick Muriuki Muriithi |
2023-01-04 | auth: Add `/register-user` endpoint...* gn3/app.py: register top-level error handlers. reorganise oauth2 blueprint.
* gn3/auth/__init__.py: reorganise oaut2 blueprint.
* gn3/auth/authentication/oauth2/views.py: reorganise oauth2 blueprint.
* gn3/auth/authorisation/exceptions.py -> gn3/auth/authorisation/errors.py
* gn3/auth/authorisation/groups.py: rename file/module
* gn3/auth/authorisation/resources.py: rename file/module
* gn3/auth/authorisation/views.py: Add `/register-user` endpoint
* gn3/auth/blueprint.py: reorganise oauth2 blueprint.
* gn3/errors.py: register top-level error handlers.
| Frederick Muriuki Muriithi |
2023-01-04 | auth: return group info as part of user details...* gn3/app.py: import blueprint from authorisation views inorder to get all
endpoints
* gn3/auth/authentication/oauth2/views.py: remove the `/user` endpoint
* gn3/auth/authorisation/views.py: add the `/user` endpoint and add the group
information to the user details.
| Frederick Muriuki Muriithi |
2023-01-04 | auth: Return only non-resource roles on `/user-roles` endpoint...Resource roles will be returned as part of the resources request.
* gn3/auth/authorisation/roles.py: Simplify query - only get non-resource
roles
* gn3/auth/authorisation/views.py: update docstring
| Frederick Muriuki Muriithi |
2023-01-03 | auth: Fetch all of a user's roles....* gn3/auth/authorisation/roles.py: Fetch roles from DB
* gn3/auth/authorisation/views.py: Provide API endpoint for user roles
* tests/unit/auth/test_roles.py: Tests to check fetching roles works correctly
Fix linting and typing issues in the following files:
* gn3/auth/authentication/oauth2/resource_server.py
* gn3/auth/authentication/oauth2/views.py
* tests/unit/auth/fixtures/oauth2_client_fixtures.py
| Frederick Muriuki Muriithi |
2022-12-28 | auth: Add resource server and /user endpoint...Add a resource server with the validator for the bearer token to protect the
resources endpoints.
Add a protected `/user` endpoint that returns the user details for valid
tokens.
* gn3/auth/authentication/oauth2/resource_server.py: new file
* gn3/auth/authentication/oauth2/views.py: add /user endpoint
| Frederick Muriuki Muriithi |
2022-12-22 | auth: implement OAuth2 flow....Add code to implement the OAuth2 flow.
* Add test fixtures for setting up users and OAuth2 clients
* Add tests for token generation with the "Password Grant" flow
* Fix some issues with test due to changes in the database connection's
row_factory
oauth2_auth_flow | Frederick Muriuki Muriithi |