Repository navigation
Conversation
get_projects_for_user now reads the optional PROJECT_ALLOWED_TYPES environment variable (comma-separated ShotGrid sg_type values) and adds an sg_type "in" filter to the Project query, so studios can control which project types are accessible in DNA. Unset or blank keeps the existing behavior. Adds unit tests for unset, blank, single and multiple types, and documents the variable in QUICKSTART.md. Closes AcademySoftwareFoundation#254 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: HungH206 <Hoanghungkz4@gmail.com>
|
|
Collaborator
|
Sorry but this was already picked up by someone else |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Adds an optional
PROJECT_ALLOWED_TYPESenvironment variable so studios can control which ShotGrid project types are accessible in DNA.ShotgridProvider.get_projects_for_usernow readsPROJECT_ALLOWED_TYPES(comma-separatedsg_typevalues, e.g.Feature,Commercial; whitespace is trimmed and empty entries are ignored). When it is set, an["sg_type", "in", [...]]filter is added to theProjectquery alongside the existingusersfilter. When it is unset or blank, behavior is unchanged. The variable is documented inQUICKSTART.md.Closes #254
Note on #262: this implements the same issue as #262, which has been open since Oct 31 and whose branch the maintainer said on Nov 18 "got a little messed up". I commented on #254 on Nov 18 asking whether #262 was still being worked on and got no reply, so I wrote this independently from the issue's description. I'm happy to close this in favor of #262 if its author finishes it, or to combine the two, whichever you prefer.
Testing
How I Tested
From
backend/, in a Python 3.11 venv (not Docker):tests/test_shotgrid_provider.py(unset, blank, single type, multiple types with whitespace,usersfilter still applied). Before the change, the single-type and multiple-type tests failed because the query contained only theusersfilter.PYTHONPATH=src python -m pytestruns the full backend suite with 860 passed and 92% coverage (the project requires 90%).black --check src/ tests/andisort --check-only src/ tests/both pass.The tests use a mocked
Shotgunclient; I did not test against a live ShotGrid site.This change was written with AI assistance (Claude); I reviewed it and the tests myself.