-
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] Implement tagging REST API: Update object tags #82
Comments
Hi, @ChrisChV! CC @pomegranited
Some premises:
I would like to suggest the following change in -def can_change_object_tag(user: User, object_tag: ObjectTag = None) -> bool:
+def can_change_object_tag(user: User, taxonomy: Taxonomy = None) -> bool: That way, we can check the permission only once before the API call in the view. What do you think? PS: We have a temp PR here with the proposed view and rule: |
@rpenido I agree with your changes, makes sense to me, but I think you should keep the logic that taxonomy admins can edit object tags of disabled taxonomies, since all the other rules maintain that logic. |
Agreed @ChrisChV! I diverged some things from the spec. I will list here to see if it is ok:
|
@rpenido About this I left a comment on the PR |
Story
"As a content author, I want to update the tags applied to my content."
Description
Implement a REST API that allows users to update the list of tags applied to a given object.
This ticket implements the API in the
oel_tagging
library, but a later ticket will use to update the tags applied to content edited in Studio.Completion criteria
Build on the work from #81 to enhance this endpoint to add support for :
PUT /api/oel_tagging/v1/object_tags/<object_id>/?taxonomy=<pk>
Note: uncertain which HTTP method to use here -- PUT? PATCH? POST?
oel_tagging.api.tag_object
to replace the list of ObjectTags associated with the given<object_id>
and taxonomy<pk>
rules.can_change_object_tag
for the existing object tags.Note: Not sure how best to do this.. Currently the
oel_tagging.api
does not get involved with anyrules
, only views care about them. Maybe pass a callback through totag_object
that lets us check this rule for the request.user before saving changes to an ObjectTag?taxonomy
parameter: (required) Taxonomy pktags
PUT data parameter: (required) list of tag "references", where either "id" or "value" is required:id
: corresponds to aTag.external_id
orTag.id
(required for closed taxonomies)value
: string, free-text tag valueAutomated testing must cover common paths in behavioral specification.
Behavioral specifications
Suppose the Open edX instance has these taxonomies:
and the following users:
PUT /api/oel_tagging/v1/object_tags/abc/?taxonomy=st1
tags = [{"id": "pt"}]
tags = []
PUT /api/oel_tagging/v1/object_tags/abc/?taxonomy=t2
tags = [{"id": "Science"}, {"id": "Chemistry"}]
PUT /api/oel_tagging/v1/object_tags/abc/?taxonomy=o1
tags = [{"value": "Interesting stuff"}, {"value": "will surely"}, {"value": "go here"}]
Documentation updates & improvements criteria
Relevant PRs/repositories
The text was updated successfully, but these errors were encountered: