Skip to content
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

fix: tickets: perms: allow if owner #1595

Merged
merged 1 commit into from
Oct 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions helpdesk/helpdesk/doctype/hd_ticket/hd_ticket.py
Original file line number Diff line number Diff line change
Expand Up @@ -735,11 +735,14 @@ def on_communication_update(self, c):
self.save()


def has_permission(doc):
user = frappe.session.user
customer = get_customer(user)
is_customer = doc.customer == customer
is_contact = doc.contact == user
is_raised = doc.raised_by == user
has_extra_permissions = is_customer or is_contact or is_raised or is_agent()
return has_extra_permissions
# Check if `user` has access to this specific ticket (`doc`). This implements extra
# permission checks which is not possible with standard permission system. This function
# is being called from hooks. `doc` is the ticket to check against
def has_permission(doc, user=None):
return (
doc.contact == user
or doc.raised_by == user
or doc.owner == user
or doc.customer == get_customer(user)
or is_agent(user)
)
Loading