Skip to content

feat(shotgrid): filter user projects by PROJECT_ALLOWED_TYPES - #292

Closed
HungH206 wants to merge 1 commit into
AcademySoftwareFoundation:mainfrom
HungH206:feat/shotgrid-allowed-project-types
Closed

HungH206 wants to merge 1 commit into
AcademySoftwareFoundation:mainfrom
HungH206:feat/shotgrid-allowed-project-types

Conversation

@HungH206

Copy link
Copy Markdown

Summary

Adds an optional PROJECT_ALLOWED_TYPES environment variable so studios can control which ShotGrid project types are accessible in DNA.

ShotgridProvider.get_projects_for_user now reads PROJECT_ALLOWED_TYPES (comma-separated sg_type values, e.g. Feature,Commercial; whitespace is trimmed and empty entries are ignored). When it is set, an ["sg_type", "in", [...]] filter is added to the Project query alongside the existing users filter. When it is unset or blank, behavior is unchanged. The variable is documented in QUICKSTART.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

  • I have tested these changes locally
  • I have run all relevant automated tests
  • I have verified this does not break existing workflows
  • For changes that can be tested in UI, I have included screenshots or gif animations of the changes. (Not applicable: backend-only change.)

How I Tested

From backend/, in a Python 3.11 venv (not Docker):

  1. Added 5 tests in tests/test_shotgrid_provider.py (unset, blank, single type, multiple types with whitespace, users filter still applied). Before the change, the single-type and multiple-type tests failed because the query contained only the users filter.
  2. After the change: PYTHONPATH=src python -m pytest runs the full backend suite with 860 passed and 92% coverage (the project requires 90%).
  3. black --check src/ tests/ and isort --check-only src/ tests/ both pass.

The tests use a mocked Shotgun client; I did not test against a live ShotGrid site.

This change was written with AI assistance (Claude); I reviewed it and the tests myself.

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>
@linux-foundation-easycla

linux-foundation-easycla Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: HungH206 / name: HungH206 (2569688)

@jspada200

Copy link
Copy Markdown
Collaborator

Sorry but this was already picked up by someone else

@jspada200 jspada200 closed this Nov 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Shotgrid: Add env var to configure project types for users

2 participants