Skip to content

Commit

Permalink
fix: incorrect caching of is_owner permissions (#21048)
Browse files Browse the repository at this point in the history
- Create a doctype
- Pick any role and only allow owner to create, read, write.
- after_insert hook re-save the document
- This will fail because there's a function call to `frappe.only_has_select_perm` which doesn't pass the is_owner, this is likely acceptable if document is not available.

Fix: cache should be separate for is_owner

Triggered from but not caused by #20810
  • Loading branch information
ankush committed May 19, 2023
1 parent 3669567 commit d0a24e6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion frappe/permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ def get_role_permissions(doctype_meta, user=None, is_owner=None):
if not user:
user = frappe.session.user

cache_key = (doctype_meta.name, user)
cache_key = (doctype_meta.name, user, bool(is_owner))

if user == "Administrator":
return allow_everything()
Expand Down

0 comments on commit d0a24e6

Please sign in to comment.