Skip to content

Commit

Permalink
fix: validation permission on tag creation (#22753)
Browse files Browse the repository at this point in the history
* fix: validation permission on `tag` creation

* refactor: apply checks on all operations

Add/remove both are controlled by update

---------

Co-authored-by: Ankush Menat <ankush@frappe.io>
  • Loading branch information
ruthra-kumar and ankush committed Oct 16, 2023
1 parent db3e4c9 commit d06a580
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions frappe/desk/doctype/tag/tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ def add_tags(tags, dt, docs, color=None):
for tag in tags:
DocTags(dt).add(doc, tag)

# return tag


@frappe.whitelist()
def remove_tag(tag, dt, dn):
Expand Down Expand Up @@ -153,6 +151,7 @@ def update_tags(doc, tags):
:param doc: Document to be added to global tags
"""
doc.check_permission("write")
new_tags = {tag.strip() for tag in tags.split(",") if tag}
existing_tags = [
tag.tag
Expand Down

0 comments on commit d06a580

Please sign in to comment.