diff --git a/core/doctype/file_data/file_data.py b/core/doctype/file_data/file_data.py index d459ee470b..51d00c0a6c 100644 --- a/core/doctype/file_data/file_data.py +++ b/core/doctype/file_data/file_data.py @@ -50,4 +50,11 @@ class DocType(): path = webnotes.utils.get_path("public", "files", self.doc.file_name) if os.path.exists(path): os.remove(path) - \ No newline at end of file + + if self.doc.attached_to_name: + # check persmission + if not webnotes.has_permission(self.doc.attached_to_doctype, + "write", self.doc.attached_to_name): + webnotes.msgprint(webnotes._("No permission to write / remove."), + raise_exception=True) + \ No newline at end of file diff --git a/core/doctype/profile/profile.js b/core/doctype/profile/profile.js index d06c63574b..977ebba616 100644 --- a/core/doctype/profile/profile.js +++ b/core/doctype/profile/profile.js @@ -22,6 +22,10 @@ cur_frm.cscript.refresh = function(doc) { cur_frm.toggle_display(['sb1', 'sb3'], false); if(!doc.__islocal){ + cur_frm.add_custom_button("Set Properties", function() { + wn.set_route("user-properties", doc.name); + }) + if(has_common(user_roles, ["Administrator", "System Manager"])) { cur_frm.toggle_display(['sb1', 'sb3'], true); } @@ -39,10 +43,6 @@ cur_frm.cscript.refresh = function(doc) { } } } - - cur_frm.add_custom_button("Set Properties", function() { - wn.set_route("user-properties", doc.name); - }) } cur_frm.cscript.enabled = function(doc) { diff --git a/core/page/permission_manager/permission_manager.js b/core/page/permission_manager/permission_manager.js index 5cc034eb42..55a4fe5d21 100644 --- a/core/page/permission_manager/permission_manager.js +++ b/core/page/permission_manager/permission_manager.js @@ -315,7 +315,7 @@ wn.PermissionEngine = Class.extend({ callback: function(r) { if(r.exc) { // exception: reverse - chk.attr("checked", chk.is(":checked") ? null : "checked"); + chk.get(0).checked = !chk.is(":checked"); } else { me.get_perm(args.name)[args.ptype]=args.value; } diff --git a/public/js/wn/form/attachments.js b/public/js/wn/form/attachments.js index 4730e1cba7..9ae34e9e21 100644 --- a/public/js/wn/form/attachments.js +++ b/public/js/wn/form/attachments.js @@ -81,7 +81,7 @@ wn.ui.form.Attachments = Class.extend({ var fileid = attachments[filename]; var me = this; - $(repl('
\ + var $attach = $(repl('
\ \