2012-07-19 13:40:31 +05:30
|
|
|
from __future__ import unicode_literals
|
2012-05-21 15:11:36 +05: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()
|
2013-05-16 15:28:19 +05:30
|
|
|
webnotes.reload_doc('core', 'doctype', 'custom_script')
|