Skip to content

Commit

Permalink
fix: incorrect caching of is_owner permissions (#21048) (#21053)
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

(cherry picked from commit d0a24e6)

Co-authored-by: Ankush Menat <ankush@frappe.io>
  • Loading branch information
mergify[bot] and ankush committed May 19, 2023
1 parent 86455b4 commit 00da02b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion frappe/permissions.py
Expand Up @@ -223,7 +223,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 00da02b

Please sign in to comment.