-
Notifications
You must be signed in to change notification settings - Fork 5
CDD 3174 - Downloads v2 endpoint #3221
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
dandammann
wants to merge
278
commits into
main
Choose a base branch
from
CDD-3174
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 250 commits
Commits
Show all changes
278 commits
Select commit
Hold shift + click to select a range
96526f5
Update theme functionality to pull available themes from the db via t…
luketowell 7446975
CDD-3175: added endpoints for retrieving subtheme/topics/metrics and …
luketowell e4bc21a
Update the model and the permission_set javascript when handling wild…
luketowell 9c7ca66
Update to add serializer to handle request and response for subthemes…
luketowell 5b2f370
CDD-3175: updated the JS to add wildcard and empty object options
luketowell b362c43
CDD-3175: Updated the topics and metrics endpoints to retrieve data f…
luketowell fd83953
CDD-3175: wired up the logic for selecting geography types
luketowell 6d37e21
CDD-3175: update permission set for geographies
luketowell ad8123c
CDD-3175: updates for limiting the creation of duplicate permission sets
luketowell 60d108f
CDD-3175: updates for handling the naming of permission sets
luketowell 57c71cb
CDD-3085: updated validations and wildcard functionality
luketowell 085bf1c
Merge branch 'main' into task/CDD-3175-permission-sets-cms
luketowell aec0c5c
CDD-3175: update migrations and add tidy up javascript and validation
luketowell d679e8d
CDD-3175: remove console logs from javascript
luketowell 9875ae4
CDD-3175: Update PermissionSet model
luketowell 5be1690
CDD-3175: Update wagtail hooks
luketowell dc45208
CDD-3175: remove print statements and tidy up field_choice_callables
luketowell 8178091
CDD-3175: Update method descriptions
luketowell cc5bd4a
CDD-3175: tidied up the geography serializer
luketowell e07efdf
CDD-3175: formatting
luketowell 6995b9e
Update documentation
luketowell 843f340
CDD-3175: linting
luketowell 7b91090
CDD-3175: tests
luketowell 3ee2a70
CDD-3176: Add initial model
6017395
CDD-3175: Initial Commit
0b2c039
Create initial permission set
527b15f
Add conditional sub_theme dropdown
058e529
Update migration file and tidy up child_theme.js
d0041f1
pip: (deps): bump python-dotenv from 1.2.1 to 1.2.2
dependabot[bot] db3eed6
Testing dummy secret with gitleaks
abdihakim92x1 2edb76e
Testing dummy secret with gitleaks
abdihakim92x1 d818ec1
Added secret scan to the existing action.yaml
abdihakim92x1 7082593
Reverted to script installation of gitleaks
abdihakim92x1 1a7b248
Changed job name
abdihakim92x1 9938b77
Changed ubuntu version
abdihakim92x1 f62bbad
Using official gitleaks action
abdihakim92x1 ea9e6e4
Updated ubuntu version
abdihakim92x1 f820650
Gitleaks arg removed
abdihakim92x1 ed11e83
CDD-3175: populate the Topic dropdown
luketowell d38cc2d
Update theme functionality to pull available themes from the db via t…
luketowell 2b2bfa6
Update to add serializer to handle request and response for subthemes…
luketowell a69ab5e
CDD-3175: updated the JS to add wildcard and empty object options
luketowell b09b509
CDD-3175: Updated the topics and metrics endpoints to retrieve data f…
luketowell 817dfb8
CDD-3085: updated validations and wildcard functionality
luketowell c3dec5d
WIP: Separate model files and create permission set block
d823c58
add name back in
e47447a
working draft
2cb5fc9
Merge branch 'task/CDD-3175-permission-sets-cms' into task/CDD-3176-a…
a9032f2
Split models into two files
6b1c4d3
CDD-3175: removed duplicate functionality
luketowell 2552243
CDD-3175: refactored naming of endpoints
luketowell 1f306f6
Add unit testing
59d2dcd
CDD-3175: update to fix wildcard selection
luketowell c3436a5
Simplified version
a8eb2be
remove old code
780a5a6
Remove old code
8b15e75
CDD-3175: update for PR comments
luketowell c05163f
CDD-3175: update for PR comments
luketowell beebd08
remove old file
1c16ace
CDD-3175: Update method annotation
luketowell 0b66789
Merge branch 'main' into task/CDD-3175-permission-sets-cms
luketowell 4a3c3b7
CDD-3175: Update method annotation
luketowell ef470ee
Merge branch 'main' into task/CDD-3175-permission-sets-cms
luketowell 4deebb3
Update checkboxes
dc3724a
Merge branch 'task/CDD-3175-permission-sets-cms' into task/CDD-3176-a…
bccf9d8
Linting fixes
8d5787c
remove merge issue
cca3cf3
linting things
e1502f5
CDD-3175: Update urls for permission set endpoints
luketowell 0c73acd
Merge branch 'main' into task/CDD-3175-permission-sets-cms
luketowell f07060c
Merge branch 'task/CDD-3175-permission-sets-cms' into task/CDD-3176-a…
luketowell 58c3fa7
CDD-3176: remove duplicated tests
luketowell 7251853
CDD-3172: Update to add the functionality for retrieving user permiss…
luketowell 34d6b85
CDD-3172: linting
luketowell 7577419
CDD-3175: Update to add ability to get by id and to create initial pe…
luketowell 7848563
CDD-3175: add group by functionality
luketowell f37ee3e
CDD-3172: small refactor of permission_hierarchy and users and topics
luketowell b77e195
Remove testing changes to truncated_dataset
luketowell 5930ec6
Remove group by geography
luketowell 0ac42ee
refactor permission grouping to group by id rather than name
luketowell 67f8ab6
CDD-3172: linting
luketowell e460266
Merge branch 'main' into task/CDD-3172-permission-hierarchy
luketowell d9c4998
CDD-3172: tests
luketowell 15627ab
CDD-3172: tests
luketowell 2ad0df8
CDD-3172: tests and refactoring
luketowell cfcd612
Merge branch 'main' into task/CDD-3172-permission-hierarchy
luketowell fef62a8
Merge branch 'main' into task/CDD-3172-permission-hierarchy
luketowell 862e777
CDD-3172: Update response format
luketowell bcf067d
sonar feedback: update based on sonarqube output
luketowell 8838794
sonar feedback: update based on sonarqube output
luketowell c023a71
Linting
luketowell 26363e2
CDD-3171: Update permission set form now it's a page not a snippet
d0540cb
Update topic page to include theme/subtheme/topic fields
e35df35
WIP: filter getPages based on is_public field
c8578bc
Move auth content underneath CMS
654b337
Expose themes/subthemes/topics on topic and metric doc child pages
0674583
Merge branch 'main' into task/CDD-3172-permission-hierarchy
luketowell c1dd464
CDD-3172: move class for blocks
luketowell 97160a7
WIP: Add theme/subtheme/topic to pages
372eadd
linting and permission set url changes
luketowell 710a865
CDD-3172: refactored naming of geography method and updated the tests…
luketowell fb29a38
CDD-3172: updated test to better name test and updated permission hie…
luketowell f588ee2
CDD-2172: Add examples for each of the potential responses for get pe…
luketowell 0584f99
CDD-2172: linting
luketowell 5b78d1e
Merge branch 'main' into task/CDD-3172-permission-hierarchy
luketowell 8bc0bbd
CDD-3147: Update Cognito User for permission sets
mattjreynolds 2a79ee3
CDD-3147: Improve logging of JWT
mattjreynolds 2ab8c2e
CDD-3147: Update readme for using JWT locally
mattjreynolds 5f7d315
CDD-3147: Update readme for using JWT locally
mattjreynolds 3f999f1
CDD-3119 Add a new SimpleMenu model.
685ab94
CDD-3119 Add panels attribute to SimpleMenu model.
b10c77b
CDD-3119 Beef up the SimpleMenu serializer tests.
5fefbfe
CDD-3232 Update chart response styles.
f34051e
pip dev: (deps-dev): bump pre-commit from 4.5.1 to 4.6.0
dependabot[bot] 8a16873
pip: (deps): bump idna from 3.11 to 3.12
dependabot[bot] a613fbf
pip dev: (deps-dev): bump gitpython from 3.1.46 to 3.1.47
dependabot[bot] f637ec3
pip: (deps): bump click from 8.3.2 to 8.3.3
dependabot[bot] 7342f33
pip: (deps): bump psycopg2-binary from 2.9.10 to 2.9.12
dependabot[bot] 80f8a7e
pip: (deps): bump pydantic from 2.13.2 to 2.13.3
dependabot[bot] 8e3cef0
build: remove simplejson dependency
jrdh de89d0b
CDD-3313: Add topic page link to headline metrics card (#3151)
tushortz c53721c
pip: (deps): bump idna from 3.12 to 3.13
dependabot[bot] b336a45
topics: add HIV topic
aidan 5f9a0d1
CDD-3087: new CMS page for logged-out functionality (#3163)
luketowell f21867e
pip: (deps): bump filelock from 3.28.0 to 3.29.0
dependabot[bot] 21ec84a
Merge branch 'task/CDD-3147-update-cognito-user-for-permission-sets' …
fc0366c
WIP: pseudo code / note form of solution
168dd31
WIP: filter pages on permission sets
112e4c7
Permission check updates and form handling
itsthatianguy 6069ae6
WIP: Fix comparison function
7891edf
Finish getPages endpoint
828301a
CDD-3172: Remove permission_sets from CMS API
mattjreynolds 0152d03
CDD-3172: Update docstring
mattjreynolds 9d3e9b4
remove redundant code
8cf08b2
Merge branch 'main' into task/CDD-3172-permission-hierarchy
mattjreynolds 230a893
fixes for existing unit tests
itsthatianguy dbbd0fb
Merge branch 'task/CDD-3172-permission-hierarchy' into task/CDD-3171-…
e0030e5
Update imports
d021645
add endpoint back in for testing
8f67ea2
fix import
36e5f18
Merge branch 'main' into task/CDD-3171-update-getpages-endpoint-for-n…
69afe07
New tests, and fixes and updates to existing tests
itsthatianguy aee34c0
Naming fixes
itsthatianguy 89025af
test coverage
itsthatianguy 2806c50
Merge branch 'main' into task/CDD-3171-update-getpages-endpoint-for-n…
ccd0cc1
CDD-3171: Tweaks
c6ce9c2
CDD-3171: Add display name to permission sets
b186842
remove log file
4e83f82
Fix js file
d7883c6
Linting
376c782
Update migration
c63e778
refactor for sonarqube checks
27fc8d9
Fix constraints on permission sets
e328d6d
update unit tests
35802ee
fix allowed_pages overwrite
834cfdc
Fix unit test
6e130fb
Fix test
6de2df7
linting
222acd2
CDD-3171: Move permission_set.js insert to Media class
mattjreynolds 5219d16
CDD-3171: Add ignores for importlint
mattjreynolds 16540f5
Merge branch 'main' into task/CDD-3171-update-getpages-endpoint-for-n…
mattjreynolds 5320494
Merge branch 'main' into task/CDD-3171-update-getpages-endpoint-for-n…
kathryn-dale f55076e
Update architectural constraints
39226d0
linting
23cec20
Merge branch 'main' into task/CDD-3171-update-getpages-endpoint-for-n…
kathryn-dale ab3aad9
Merge branch 'main' into task/CDD-3171-update-getpages-endpoint-for-n…
mattjreynolds 084949c
Update wildcard value in viewsets
6b88ea7
Update test
147916a
remove comment
ebc6fcd
Update import
efb3ff8
fix test name
7a1f09d
Merge branch 'main' into task/CDD-3171-update-getpages-endpoint-for-n…
kathryn-dale 9d66874
linting
mattjreynolds a23fd65
combine imports
mattjreynolds fd5306e
refactor for simplicity
81e3678
linting
8708ada
CDD-3173: prototype authorization curl call on /api/downloads/v2
dandammann 7c3cb93
Merge branch 'main' into task/CDD-3171-update-getpages-endpoint-for-n…
kathryn-dale 095c1f9
Merge branch 'task/CDD-3171-update-getpages-endpoint-for-non-public-i…
dandammann e98220f
CDD-3173: get rid of check_permissions_by_name() and make /api/downlo…
dandammann bf2dac1
CDD-3173: let cms/dashboard/viewsets.py from CDD-3171 use my fully eq…
dandammann f6dc300
CDD-3173: add debugging code to user_manager.py to be able to test th…
dandammann 6d65dde
CDD-3173: evaluate metric- and geography-related permissions separately
dandammann 2d3677e
CDD-3173: lint
dandammann 75a0bf5
CDD-3173: lint
dandammann 2962d89
CDD-3173: convert permission function arguments into named arguments …
dandammann e503dc5
Merge remote-tracking branch 'origin/CDD-3174' into CDD-3174
dandammann 3e88ad0
CDD-3173: move things around for architectural constraints
dandammann 7994f93
Merge branch 'main' into CDD-3174
kathryn-dale 341d0c4
Merge remote-tracking branch 'origin/main' into CDD-3174
dandammann a139311
Merge remote-tracking branch 'origin/CDD-3174' into CDD-3174
dandammann f123e94
Merge remote-tracking branch 'origin/main' into task/CDD-3171-update-…
dandammann 0e0edde
Merge branch 'task/CDD-3171-update-getpages-endpoint-for-non-public-i…
dandammann 02f6dd9
CDD-3173: reduce noisy comments
dandammann 5c06686
CDD-3173: remove rbac_permissions parameter (easy to do, cos doesn't …
dandammann cc9e8cc
Pass permission set array to check permissions
9a5dd44
CDD-3174: re-added noisy comment
dandammann f62690c
CDD-3174: formalize comment
dandammann b903872
CDD-3174: revert rbac_permissions warning fix
dandammann a7b44f4
CDD-3174: revert every logger.info("Entered function ...)
dandammann b02b3e6
Add logs for permission sets
bd453de
CDD-3174: revert SQL printing
dandammann 58aaaa0
CDD-3174: revert permission set debugging
dandammann 9dc72c6
CDD-3174: add type hints to permission functions & vars
dandammann 56b8368
Merge branch 'task/CDD-3171-update-getpages-endpoint-for-non-public-i…
dandammann 3dbd718
CDD-3174: make permissions disallow empty "" requests
dandammann c0d0c66
Update test mock and linting
3c1bf03
Merge remote-tracking branch 'origin/CDD-3174' into CDD-3174
dandammann 67febed
CDD-3174: centralize WILDCARD_ID_VALUE
dandammann 43c0824
Merge branch 'main' into task/CDD-3171-update-getpages-endpoint-for-n…
kathryn-dale 0df6927
CDD-3174: use MetricsAPIInterface to access data mappers from common …
dandammann 24d3c0e
CDD-3174: remove duplicate check_metric_related_permissions() call
dandammann 7bc008f
CDD-3174: add BaseRequestParams() class that all other request class…
dandammann b154d0b
Update log
0277a42
Update log line
1a7bad4
CDD-3174: add named arguments to check_permissions()
dandammann abe251d
CDD-3174: fix viewsets.py error since merge
dandammann d5591d5
CDD-3174: simplify convoluted WHERE clauses in SQL
dandammann 1151727
Merge branch 'task/CDD-3171-update-getpages-endpoint-for-non-public-i…
dandammann bb7be29
CDD-3174: add _get_id_string_or_none() to normalize strings to preven…
dandammann d755cd8
CDD-3174: separate check_page_permissions() and check_chart_permissio…
dandammann caab168
CDD-3174: add tests for permission filtering functionality
dandammann ed4ce7c
CDD-3174: move TestCheckPagePermissions() from test_viewsets.py to te…
dandammann 0e6ccb5
Merge branch 'main' into CDD-3174
dandammann f1836ec
Merge branch 'main' into CDD-3174
dandammann 626c2cc
CDD-3174: log user permissions for every API call that comes with a JWT
dandammann 3c9c5df
Merge remote-tracking branch 'origin/CDD-3174' into CDD-3174
dandammann 3053ed0
Merge branch 'main' into CDD-3174
dandammann 2eca63f
CDD-3174: make comment more prominent (so it can't be missed)
dandammann b22166c
CDD-3174: simplify permission logging
dandammann ac01e3f
Merge remote-tracking branch 'origin/CDD-3174' into CDD-3174
dandammann edf90b2
Merge branch 'main' into CDD-3174
dandammann 4feb80e
CDD-3174: avoid illogical ChartRequestParams(ChartRequestParams) clas…
dandammann 5cad8b3
Merge branch 'main' into CDD-3174
dandammann cfb1ff0
Merge remote-tracking branch 'origin/CDD-3174' into CDD-3174
dandammann 0ccac93
CDD-3174: simplify to "if permission_sets and check_chart_permissions…
dandammann 319ae14
CDD-3174: remove 2 redundant check_chart_permissions() tests
dandammann 952a5e0
CDD-3174: add docstrings to functions
dandammann 33c1b32
CDD-3174: remove duplicate sanity check
dandammann ad9584d
CDD-3174: build permission set from the non-public instead of the pub…
dandammann 6f0bb5d
CDD-3174: fix type hints
dandammann ddcd49d
CDD-3174: call log_user_permission_summary() not on every API call an…
dandammann 8f152db
CDD-3174: fix lint
dandammann ea46ddf
Merge branch 'main' into CDD-3174
sahmed06 706e191
CDD-3174: protect against geographies with the same name across geogr…
dandammann ab17dd9
Merge remote-tracking branch 'origin/CDD-3174' into CDD-3174
dandammann bdc8073
CDD-3174: fix geography code bug
dandammann 675ad0a
CDD-3174: remove old RBAC @require_authorisation decorator from Downl…
dandammann b07fa00
Merge remote-tracking branch 'origin/main' into CDD-3174
mattjreynolds bb21a16
Merge branch 'main' into CDD-3174
sahmed06 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| """Utilities for logging authentication and permission information across the API.""" | ||
|
|
||
| import logging | ||
| from typing import Any | ||
|
|
||
| logger = logging.getLogger(__name__) | ||
|
|
||
|
|
||
| def log_user_permissions(user: Any) -> None: | ||
| """Log permission information for an authenticated user. | ||
|
|
||
| This function logs the permission set summary and global access status. | ||
| It expects ``user.permission_sets`` to be a dict with the shape produced | ||
| by ``CognitoManager.get_or_create_for_cognito``: | ||
|
|
||
| .. code-block:: python | ||
|
|
||
| { | ||
| "permission_sets": [...], | ||
| "summary": {"total_permission_sets": 2, "has_global_access": False}, | ||
| } | ||
|
|
||
| Args: | ||
| user: The authenticated user object that has a ``permission_sets`` dict. | ||
| """ | ||
|
|
||
| if not hasattr(user, "username"): | ||
| return | ||
| if not hasattr(user, "permission_sets"): | ||
| return | ||
|
|
||
| username = user.username | ||
| permission_sets = user.permission_sets | ||
|
|
||
| if not isinstance(permission_sets, dict): | ||
| return | ||
|
|
||
| log_msg = f'User {username} has total permission sets {permission_sets["summary"]["total_permission_sets"]}' | ||
|
|
||
| if permission_sets["summary"]["has_global_access"]: | ||
| log_msg += " and global access" | ||
|
|
||
| logger.info(log_msg) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.