-
Notifications
You must be signed in to change notification settings - Fork 1
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
[Tagging] Taxonomies for Org API #74
Comments
Hi @pomegranited!
Or:
I supose the former, right? |
Good catch, thank you @rpenido ! Issue updated with your first suggestion. |
What about returning 400 with |
@rpenido I'm not sure.. it's ok to return a 400 for now, and if we need to change it to return an empty list, we can do that later. |
I updated this issue with the effects of Product's amendment to our interpretation of taxonomy permissions:
|
Hi @pomegranited! Some small questions:
This should be
This doesn't change anything for the Taxonomy API, but only content creators will tag objects, right? Is ok to restrict the list by user org?
/api/content_tagging/v1/taxonomy/context/?enabled=True -- returns enabled taxonomies the user is allowed to view.
|
Correct -- users will have to be "content creators for the content object's org" in order to tag objects.
No. There is no need to involve the user's orgs here at all. It simplifies/speeds up the queries, and keeps the code simple too. This data is not protected or precious, so we don't need to treat it as such. |
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=1
pk
s), with the same fields and serializers as the "oel_tagging taxonomy list view".enabled
parameter)org
parameter: (optional) Organization short nameenabled
parameter: 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.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 thenext
page 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
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./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:next
url providingpage=4
)Documentation updates & improvements criteria
Relevant PRs/repositories
Code that is content- or org-specific should build on this change.
The text was updated successfully, but these errors were encountered: