make server side custom script readonly for system manager

This commit is contained in:
Anand Doshi 2012-05-21 15:11:36 +05:30
parent 8db7ff3b36
commit 6420e602e0
2 changed files with 35 additions and 0 deletions

View File

@ -0,0 +1,30 @@
def execute():
"""Make server custom script readonly for system manager"""
import webnotes.model.doc
new_perms = [
{
'parent': 'Custom Script',
'parentfield': 'permissions',
'parenttype': 'DocType',
'role': 'System Manager',
'permlevel': 1,
'read': 1,
},
{
'parent': 'Custom Script',
'parentfield': 'permissions',
'parenttype': 'DocType',
'role': 'Administrator',
'permlevel': 1,
'read': 1,
'write': 1
},
]
for perms in new_perms:
doc = webnotes.model.doc.Document('DocPerm')
doc.fields.update(perms)
doc.save()
webnotes.conn.commit()
webnotes.conn.begin()
import webnotes.model.sync
webnotes.model.sync.sync('core', 'custom_script')

View File

@ -372,5 +372,10 @@ patch_list = [
'patch_file': 'customize_form_cleanup',
'description': 'cleanup customize form records'
},
{
'patch_module': 'patches.may_2012',
'patch_file': 'cs_server_readonly',
'description': 'Make server custom script readonly for system manager'
},
]