aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2022-11-16Inject SPARQLWrapper as a parameterMunyoki Kilyungi
* gn3/db/rdf.py: Delete gn3.setting.SPARQL_ENDPOINT import. (sparql_query): Inject SPARQLWrapper. (get_dataset_metadata): Ditto.
2022-11-15auth: Add `create_group_role` function.Frederick Muriuki Muriithi
2022-11-15auth: Return results of calling function directlyFrederick Muriuki Muriithi
* gn3/auth/authorisation/checks.py: Return results of calling the function rather than a dict of values that include the results. * gn3/auth/authorisation/groups.py: Use the newer form of `authorised_p` decorator. * tests/unit/auth/test_groups.py: Update tests
2022-11-15auth: Specify types for privileges, roles, groupsFrederick Muriuki Muriithi
Use specified types for privileges, roles and types rather than using strings to help with limiting bugs. * gn3/auth/authorisation/groups.py: Specify and use the `Group` type * gn3/auth/authorisation/privileges.py: Specify and use the `Privilege` type * gn3/auth/authorisation/roles.py: Specify the `Role` type. Add the `create_role` function.
2022-11-15Add missing module __init__.py to mitigate the mypy errorsFrederick Muriuki Muriithi
2022-11-15pylint: Fix a myriad of linting errorsFrederick Muriuki Muriithi
2022-11-15auth: Add some typing information to the functionsFrederick Muriuki Muriithi
2022-11-15auth: Reorganise package - move function to `checks` moduleFrederick Muriuki Muriithi
* gn3/auth/authorisation/__init__.py: delete function * gn3/auth/authorisation/checks.py: move function to `checks` module
2022-11-15pylint: Fix linting errors.Frederick Muriuki Muriithi
2022-11-15tests: typo: fix migration script file nameFrederick Muriuki Muriithi
2022-11-15tests: Use `gn3.auth.db` functions for db connection and cursorFrederick Muriuki Muriithi
* tests/unit/auth/conftest.py: use the functions in `gn3.auth.db` to acquire the database connection and cursor since they handle some of the basic issues like rollback and commit, meaning we do not have to explicitly handle said issues in the fixtures.
2022-11-15tests: Fix cause of `DeprecationWarning`Frederick Muriuki Muriithi
* tests/unit/auth/test_groups.py: use Flask's application context directly rather than the request context to access `g` in order to get rid of the `DeprecationWarning`.
2022-11-14auth: Implement `create_group`Frederick Muriuki Muriithi
2022-11-14tests: split test app and test clientFrederick Muriuki Muriithi
* The test app and the test client are both needed as fixtures in different places
2022-11-14Migrations: Create `user_roles` tableFrederick Muriuki Muriithi
* migrations/auth/20221114_05_hQun6-create-user-roles-table.py: new migration * tests/unit/auth/test_migrations_create_tables.py: test new migration * tests/unit/auth/test_migrations_indexes.py: test new migration
2022-11-14auth: Add test for `create_group`Frederick Muriuki Muriithi
* gn3/auth/authorisation/__init__.py: Add `authorised_p` decorator to be used for all function requiring authorisation. * gn3/auth/authorisation/groups.py: Add `create_group` function stub * tests/unit/auth/conftest.py: Add fixture for test users * tests/unit/auth/test_groups.py: Add tests for `create_group`
2022-11-14Migrations: Add `user_editable` field to roles tableFrederick Muriuki Muriithi
Some roles will not be user editable to prevent inconsistencies, and possible privilege escalation. * migrations/auth/20221110_05_BaNtL-create-roles-table.py: Add `user_editable` column to table * migrations/auth/20221114_04_tLUzB-initialise-basic-roles.py: Set `group-leader` role as not user editable
2022-11-14Migrations: Create the `group-leader` role and give it privilegesFrederick Muriuki Muriithi
* migrations/auth/20221114_04_tLUzB-initialise-basic-roles.py: new migration * tests/unit/auth/test_migrations_insert_data_into_empty_table.py: test new migration
2022-11-14Migrations: Create `group_roles` tableFrederick Muriuki Muriithi
* migrations/auth/20221110_05_BaNtL-create-roles-table.py: modify migration * migrations/auth/20221114_03_PtWjc-create-group-roles-table.py: new migration * tests/unit/auth/test_migrations_create_tables.py: test new migration * tests/unit/auth/test_migrations_indexes.py: test new migration
2022-11-14Migrations: Drop `generic_role*` tablesFrederick Muriuki Muriithi
Drop the `generic_role*` tables, since what they were envisioned for can be handled a different, (arguably) more simple way. * migrations/auth/20221114_02_DKKjn-drop-generic-role-tables.py: new migration * tests/unit/auth/test_migrations_drop_tables.py: test new migration
2022-11-14Rename files for consistencyFrederick Muriuki Muriithi
* Name all tests that test migrations to start with `test_migrations_`
2022-11-14Migrations: Add generic_role_privileges tableFrederick Muriuki Muriithi
Add table `generic_role_privileges` table to link the generic roles to the privileges they provide. * migrations/auth/20221114_01_n8gsF-create-generic-role-privileges-table.py: new migration * tests/unit/auth/test_create_table_migrations.py: test new migration * tests/unit/auth/test_migrations_indexes.py: test new migration
2022-11-14Migrations: Migration for initial privilegesFrederick Muriuki Muriithi
* migrations/auth/20221113_01_7M0hv-enumerate-initial-privileges.py: new migration. * tests/unit/auth/test_migrations_insert_data_into_empty_table.py: test new migration.
2022-11-13Documentation: Explain how to run migrationsFrederick Muriuki Muriithi
* .gitignore: ignore all yoyo configuration files * README.md: Update documentation * yoyo.auth.ini: stop tracking the yoyo configuration file.
2022-11-10Migrations: Add columns to 'privileges' tableFrederick Muriuki Muriithi
* migrations/auth/20221110_08_23psB-add-privilege-category-and-privilege-description-columns-to-privileges-table.py: new migration * tests/unit/auth/test_migrations_add_remove_columns.py: test new migration
2022-11-10Tests: Generalise tests for adding/removing columns to/from tablesFrederick Muriuki Muriithi
2022-11-10Migrations: migration for `role_privileges` tableFrederick Muriuki Muriithi
* migrations/auth/20221110_07_7WGa1-create-role-privileges-table.py: new migration Commit ee72678fabb86d66ba7d61d26643cc73df94ee5d only contains tests for this migration.
2022-11-10Migrations: migration for `role_privileges` tableFrederick Muriuki Muriithi
* tests/unit/auth/test_create_table_migrations.py: new migration * tests/unit/auth/test_migrations_indexes.py: test new migration
2022-11-10Migrations: migration for 'generic_roles' tableFrederick Muriuki Muriithi
* migrations/auth/20221110_06_Pq2kT-create-generic-roles-table.py: new migration * tests/unit/auth/test_create_table_migrations.py: test new migration
2022-11-10Migrations: migration for 'roles' tableFrederick Muriuki Muriithi
* migrations/auth/20221110_05_BaNtL-create-roles-table.py: new migration * tests/unit/auth/test_create_table_migrations.py: test new migration * tests/unit/auth/test_migrations_indexes.py: test new migration
2022-11-10Migrations: migration for 'genotype_resources' tableFrederick Muriuki Muriithi
* migrations/auth/20221110_04_6PRFQ-create-genotype-resources-table.py: new migration * tests/unit/auth/test_create_table_migrations.py: test new migration
2022-11-10Migrations: Add migration for 'phenotype_resources' tableFrederick Muriuki Muriithi
* migrations/auth/20221110_03_ka3W0-create-phenotype-resources-table.py: new migration * tests/unit/auth/test_create_table_migrations.py: test for new migration
2022-11-10Migrations: Add migration for mrna_resources tableFrederick Muriuki Muriithi
* migrations/auth/20221110_02_z1dWf-create-mrna-resources-table.py: new migration * tests/unit/auth/test_create_table_migrations.py: test for new migration
2022-11-10Migrations: Add migration for 'resources' tableFrederick Muriuki Muriithi
* gn3/migrations.py: Minor change * migrations/auth/20221110_01_WtZ1I-create-resources-table.py: new migration * tests/unit/auth/test_create_table_migrations.py: test new migration
2022-11-09Migrations: Add `resource_meta` field to `resource_categories` tableFrederick Muriuki Muriithi
2022-11-09Tests: Provide backend fixture to (apply|rollback)_single_migrationFrederick Muriuki Muriithi
2022-11-08Fix issue where only primary samples were used when all samples arezsloan
selected This is because base_samples was set to all_samples_ordered, which only includes primary samples + parents/f1s. Setting this to an empty list fixed the issue and caused it to use all samples again.
2022-11-08Migrations: Improve `resource_categories` data tests.Frederick Muriuki Muriithi
* tests/unit/auth/test_migration_init_data_in_resource_categories_table.py: Test that the data is initialised properly. Test that rollback works as expected.
2022-11-08Migrations: Init `resource_categories` with initial categoriesFrederick Muriuki Muriithi
* migrations/auth/20221108_04_CKcSL-init-data-in-resource-categories-table.py: new migration. * tests/unit/auth/test_migration_init_data_in_resource_categories_table.py: test new migration.
2022-11-08Migrations: Create `resource_categories` table.Frederick Muriuki Muriithi
* migrations/auth/20221108_03_Pbhb1-create-resource-categories-table.py: new migration. * tests/unit/auth/test_create_table_migrations.py: test new migration.
2022-11-08Migrations: Create `privileges` table.Frederick Muriuki Muriithi
* migrations/auth/20221108_02_wxTr9-create-privileges-table.py: new migration * tests/unit/auth/test_create_table_migrations.py: test new migration
2022-11-08Tests: Fix test name.Frederick Muriuki Muriithi
2022-11-08Tests: Fix typo: remove variable from quotes.Frederick Muriuki Muriithi
2022-11-08Add migration to create the groups table.Frederick Muriuki Muriithi
2022-11-08Tests: Generalise testing 'CREATE TABLE' migrationsFrederick Muriuki Muriithi
* gn3/settings.py: Omit trailing slash * tests/unit/auth/test_create_table_migrations.py: Generalise testing migrations that create tables. * tests/unit/auth/test_create_user_credentials_table.py: delete * tests/unit/auth/test_migration_create_users_table.py: delete
2022-11-08CLI: Provide `apply-migrations` command for flaskFrederick Muriuki Muriithi
* main.py: Provide the `apply-migrations` CLI command to run the migrations against the auth database. The command can be invoked with: $ flask apply-migrations
2022-11-08Settings: Provide default `AUTH_DB` setting.Frederick Muriuki Muriithi
2022-11-08Tests: Tests the credentials check systemFrederick Muriuki Muriithi
* gn3/auth/authentication.py: Fix issues caught by tests * tests/unit/auth/test_credentials.py: Add fixtures and tests for credentials checking
2022-11-08Tests: Test migration to create user_credentials tableFrederick Muriuki Muriithi
* tests/unit/auth/test_create_user_credentials_table.py: new tests
2022-11-08Tests: Separate *ALL* unit test fixtures from auth-specific onesFrederick Muriuki Muriithi
* tests/unit/auth/conftest.py: add fixtures specific to auth * tests/unit/auth/test_migration_create_users_table.py: import from new fixtures module * tests/unit/conftest.py: remove auth-specific fixtures from *ALL* unit tests fixture module.