Skip to content

Commit

Permalink
fix: validation permission on tag creation (#22753) (#22754)
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>
(cherry picked from commit d06a580)

Co-authored-by: ruthra kumar <ruthra@erpnext.com>
  • Loading branch information
mergify[bot] and ruthra-kumar committed Oct 16, 2023
1 parent 0270846 commit 6247aa0
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions frappe/desk/doctype/tag/tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,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,8 +151,8 @@ def update_tags(doc, tags):
:param doc: Document to be added to global tags
"""

new_tags = list(set([tag.strip() for tag in tags.split(",") if tag]))
doc.check_permission("write")
new_tags = {tag.strip() for tag in tags.split(",") if tag}
existing_tags = [
tag.tag
for tag in frappe.get_list(
Expand Down

0 comments on commit 6247aa0

Please sign in to comment.