You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"As a content author, I want to see all the taxonomies available for use with my course, block, or library, so that I can tag my content."
Description
Implement a Python and a REST API that allows retrieving the full list of taxonomies given a certain block/context.
This API will be used to fetch the taxonomies relevant to creating/editing content on Studio.
Note: this API should be marked as “unstable” for the MVP.
Completion criteria
Build on/subclass the "taxonomy REST API view" added by #73, and implement this REST API endpoint:
If omitted, then returns both enabled and disabled Taxonomies.
If True, then returns only enabled Taxonomies
If False, then returns only disabled Taxonomies
Paginate this data, with a default MAX_PAGE_SIZE = 100, to allow most people to retrieve all of their taxonomies in one hit.
People with more taxonomies will need to know where to go to get their next page of data, and so this endpoint should support that too.
Note: it's ok to adjust the openedx.features.content_tagging.rules to meet the behavioral requirements noted below.
Automated testing must cover common paths in behavioral specification.
Pagination
You're welcome to rename the pagination parameters and data specified here to whatever is the standard recommended by DRF Pagination or Django Pagination.
For your tests, feel free to set a more reasonable MAX_PAGE_SIZE to test the next page behavior.
Behavioral specifications
Suppose the Open edX instance has these taxonomies:
2 taxonomies owned by organization A: tA1 (enabled), tA2 (disabled)
2 taxonomies owned by organization B: tB1 (enabled), tB2 (disabled)
2 taxonomies owned by both organizations A & B: tC1 (enabled), tC2 (disabled)
and the following users:
userA: ordinary, non-staff user
userS: global staff user
Anyone can view an enabled taxonomy or its tags
Only superusers or global staff can view a disabled taxonomy or its tags.
Only superusers or global staff can assign orgs to a taxonomy.
These assigned "orgs" will be used to filter which taxonomies returned when the org parameter is provided for the list view, but don't affect taxonomy/tag permissions.
No users can add/edit/delete a system-defined taxonomy.
Only superusers or global staff can add/edit/delete a taxonomy (so long as it isn't system-defined)
Only superusers can add/edit/delete tags on a taxonomy (where allow_free_text=False)
No users can add/edit/delete tags on a free text taxonomy.
/api/content_tagging/v1/taxonomy/ -- returns all taxonomies the user is allowed to view.
When userA requests ^, they receive taxonomy metadata for these taxonomies: s1, t1, tA1, tB1, tC1
When userS requests ^ they receive taxonomy metadata for these taxonomies: s1, s2, t1, t2, tA1, tA2, tB1, tB2, tC1, tC2
/api/content_tagging/v1/taxonomy/context/?enabled=True -- returns enabled taxonomies the user is allowed to view.
When userA or userS requests ^, they receive taxonomy metadata for these taxonomies: s1, t1, tA1, tB1, tC1
/api/content_tagging/v1/taxonomy/context/?enabled=False -- returns disabled taxonomies the user is allowed to view.
When userA requests ^, they receive no taxonomy metadata at all
When userS requests ^ they receive taxonomy metadata for these taxonomies: s2, t2, tA2, tB2, tC2
/api/content_tagging/v1/taxonomy/?org=A -- returns taxonomies the user is allowed to view which are configured for use with content owned by org A
When userA requests ^, they receive taxonomy metadata for these taxonomies: s1, t1, tA1, tA2, tC1, tC2
When userS requests ^ they receive taxonomy metadata for these taxonomies: s1, s2, t1, t2, tA1, tA2, tC1, tC2
/api/content_tagging/v1/taxonomy/?org=B -- returns taxonomies the user is allowed to view which are configured for use with content owned by org B
When userA requests ^, they receive taxonomy metadata for these taxonomies: s1, t1, tB1, tB2, tC1, tC2
When userS requests ^ they receive taxonomy metadata for these taxonomies: s1, s2, t1, t2, tB1, tB2, tC1, tC2
/api/content_tagging/v1/taxonomy/?org=A&enabled=True -- returns enabled taxonomies the user is allowed to view which are configured for use with content owned by org A
When userA requests ^, they receive taxonomy metadata for these taxonomies: s1, t1, tA1, tC1
When userS requests ^ they receive taxonomy metadata for these taxonomies: s1, t1, tA1, tC1
/api/content_tagging/v1/taxonomy/?org=A&enabled=False -- returns disabled taxonomies the user is allowed to view which are configured for use with content owned by org A (No explicit use case exists for this combination, but it's included here for completeness.)
When userA requests ^, they receive no taxonomy metadata at all
When userS requests ^ they receive taxonomy metadata for these taxonomies: s2, t2, tA2, tC2
/api/content_tagging/v1/taxonomy/?org=X -- returns taxonomies the user is allowed to view which are configured for use with content owned by org X.
But there are no taxonomies configured for use with org X -- org X may not even exist -- and so only returns:
When userA requests ^, they receive taxonomy metadata for these taxonomies: s1, t1
When userS requests ^ they receive taxonomy metadata for these taxonomies: s1, s2, t1, t2
/api/content_tagging/v1/taxonomy/?page_size=2&page=3 -- returns "page 3 of the taxonomies the user is allowed to view.
Since we've specified page_size=2, we'd see the following returned taxonomies here:
When userA requests ^, they receive taxonomy metadata for these taxonomies: tC1
When userS requests ^ they receive taxonomy metadata for these taxonomies: tA1, tA2 (with next url providing page=4)
Documentation updates & improvements criteria
API endpoint and its parameters should be well-documented
Story
"As a content author, I want to see all the taxonomies available for use with my course, block, or library, so that I can tag my content."
Description
Implement a Python and a REST API that allows retrieving the full list of taxonomies given a certain block/context.
This API will be used to fetch the taxonomies relevant to creating/editing content on Studio.
Note: this API should be marked as “unstable” for the MVP.
Completion criteria
Build on/subclass the "taxonomy REST API view" added by #73, and implement this REST API endpoint:
/api/content_tagging/v1/taxonomy?org=<org>&enabled=True|False&page_size=<size>&page=1pks), with the same fields and serializers as the "oel_tagging taxonomy list view".enabledparameter)orgparameter: (optional) Organization short nameenabledparameter: bool (same behavior as [Tagging] Taxonomy view/management APIs #73)MAX_PAGE_SIZE = 100, to allow most people to retrieve all of their taxonomies in one hit.People with more taxonomies will need to know where to go to get their next page of data, and so this endpoint should support that too.
Note: it's ok to adjust the
openedx.features.content_tagging.rulesto meet the behavioral requirements noted below.Automated testing must cover common paths in behavioral specification.
Pagination
You're welcome to rename the pagination parameters and data specified here to whatever is the standard recommended by DRF Pagination or Django Pagination.
For your tests, feel free to set a more reasonable
MAX_PAGE_SIZEto test thenextpage behavior.Behavioral specifications
Suppose the Open edX instance has these taxonomies:
and the following users:
userA: ordinary, non-staff user
userS: global staff user
Anyone can view an enabled taxonomy or its tags
Only superusers or global staff can view a disabled taxonomy or its tags.
Only superusers or global staff can assign orgs to a taxonomy.
These assigned "orgs" will be used to filter which taxonomies returned when the
orgparameter is provided for the list view, but don't affect taxonomy/tag permissions.No users can add/edit/delete a system-defined taxonomy.
Only superusers or global staff can add/edit/delete a taxonomy (so long as it isn't system-defined)
Only superusers can add/edit/delete tags on a taxonomy (where allow_free_text=False)
No users can add/edit/delete tags on a free text taxonomy.
/api/content_tagging/v1/taxonomy/-- returns all taxonomies the user is allowed to view./api/content_tagging/v1/taxonomy/context/?enabled=True-- returns enabled taxonomies the user is allowed to view./api/content_tagging/v1/taxonomy/context/?enabled=False-- returns disabled taxonomies the user is allowed to view./api/content_tagging/v1/taxonomy/?org=A-- returns taxonomies the user is allowed to view which are configured for use with content owned by org A/api/content_tagging/v1/taxonomy/?org=B-- returns taxonomies the user is allowed to view which are configured for use with content owned by org B/api/content_tagging/v1/taxonomy/?org=A&enabled=True-- returns enabled taxonomies the user is allowed to view which are configured for use with content owned by org A/api/content_tagging/v1/taxonomy/?org=A&enabled=False-- returns disabled taxonomies the user is allowed to view which are configured for use with content owned by org A (No explicit use case exists for this combination, but it's included here for completeness.)/api/content_tagging/v1/taxonomy/?org=X-- returns taxonomies the user is allowed to view which are configured for use with content owned by org X.But there are no taxonomies configured for use with org X -- org X may not even exist -- and so only returns:
/api/content_tagging/v1/taxonomy/?page_size=2&page=3-- returns "page 3 of the taxonomies the user is allowed to view.Since we've specified
page_size=2, we'd see the following returned taxonomies here:nexturl providingpage=4)Documentation updates & improvements criteria
Relevant PRs/repositories
Code that is content- or org-specific should build on this change.