2
0
mirror of https://github.com/frappe/frappe.git synced 2024-06-03 03:50:49 +00:00

fix: validation permission on tag creation (#22753)

* 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>
This commit is contained in:
ruthra kumar 2023-10-16 18:08:00 +05:30 committed by GitHub
parent db3e4c9cfc
commit d06a5808cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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):
@ -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