Merge pull request #11304 from scmmishra/fix-perm-duplication-issue

fix: DocPerm duplication
This commit is contained in:
mergify[bot] 2020-08-24 08:17:41 +00:00 committed by GitHub
commit 03fedd0994
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View file

@ -989,7 +989,8 @@ def clear_permissions_cache(doctype):
`tabHas Role`,
`tabDocPerm`
WHERE `tabDocPerm`.`parent` = %s
AND `tabDocPerm`.`role` = `tabHas Role`.`role`
AND `tabDocPerm`.`role` = `tabHas Role`.`role`
AND `tabHas Role`.`parenttype` = 'User'
""", doctype):
frappe.clear_cache(user=user)

View file

@ -334,6 +334,7 @@ frappe.PermissionEngine = Class.extend({
});
this.body.on("click", "input[type='checkbox']", function() {
frappe.dom.freeze();
var chk = $(this);
var args = {
role: chk.attr("data-role"),
@ -348,6 +349,7 @@ frappe.PermissionEngine = Class.extend({
method: "update",
args: args,
callback: function(r) {
frappe.dom.unfreeze();
if(r.exc) {
// exception: reverse
chk.prop("checked", !chk.prop("checked"));
@ -374,8 +376,7 @@ frappe.PermissionEngine = Class.extend({
options:me.options.roles, reqd:1,fieldname:"role"},
{fieldtype:"Select", label:__("Permission Level"),
options:[0,1,2,3,4,5,6,7,8,9], reqd:1, fieldname: "permlevel",
description: __("Level 0 is for document level permissions, \
higher levels for field level permissions.")}
description: __("Level 0 is for document level permissions, higher levels for field level permissions.")}
]
});
if(me.get_doctype()) {