#NEWLINE# def set_user_permission_doctypes( doctype , role , apply_user_permissions , user_permission_doctypes ) : #NEWLINE# #INDENT# user_permission_doctypes = ( None if ( not user_permission_doctypes ) else json . dumps ( user_permission_doctypes ) ) #NEWLINE# frappe . db . sql ( 'update `tabDocPerm` set apply_user_permissions=%(apply_user_permissions)s,\n\t\tuser_permission_doctypes=%(user_permission_doctypes)s\n\t\twhere parent=%(doctype)s and permlevel=0\n\t\tand `read`=1 and role=%(role)s' , { #NEWLINE# #INDENT# 'apply_user_permissions' : apply_user_permissions , #NEWLINE# 'user_permission_doctypes' : user_permission_doctypes , #NEWLINE# 'doctype' : doctype , #NEWLINE# 'role' : role , #NEWLINE# #UNINDENT# } ) #NEWLINE# frappe . clear_cache ( doctype = doctype )