[fresh install] [fix] replace allow roles with explicit has_permission checks for doctype py files

This commit is contained in:
Anand Doshi
2013-07-05 12:57:03 +05:30
parent 44935e4608
commit 901773a139
4 changed files with 23 additions and 14 deletions

View File

@@ -13,7 +13,7 @@ def get_doctypes():
return webnotes.conn.sql_list("""select name from tabDocType
where ifnull(allow_rename,0)=1 and module!='Core' order by name""")
@webnotes.whitelist(allow_roles=["System Manager"])
@webnotes.whitelist()
def upload(select_doctype=None, rows=None):
from webnotes.utils.datautils import read_csv_content_from_uploaded_file
from webnotes.modules import scrub
@@ -21,6 +21,9 @@ def upload(select_doctype=None, rows=None):
if not select_doctype:
select_doctype = webnotes.form_dict.select_doctype
if not webnotes.has_permission(select_doctype, "write"):
raise webnotes.PermissionError
if not rows:
rows = read_csv_content_from_uploaded_file()