def update_share_permissions(role_permissions, doc, user):
 share_ptypes = (u'read', u'write', u'share')
 permissions_by_share = frappe.db.get_value(u'DocShare', {u'share_doctype': doc.doctype, u'share_name': doc.name, u'user': user}, share_ptypes, as_dict=True)
 if permissions_by_share:
  for ptype in share_ptypes:
   if permissions_by_share[ptype]:
    role_permissions[ptype] = 1

def update_share_permissions ( role_permissions , doc , user ) : share_ptypes = ( u'read' , u'write' , u'share' ) permissions_by_share = frappe . db . get_value ( u'DocShare' , { u'share_doctype' : doc . doctype , u'share_name' : doc . name , u'user' : user } , share_ptypes , as_dict = True ) if permissions_by_share : for ptype in share_ptypes : if permissions_by_share [ ptype ] : role_permissions [ ptype ] = 1
updates share permissions on role_permissions for given doc .