def get_all_perms(role):
 perms = frappe.get_all(u'DocPerm', fields=u'*', filters=dict(role=role))
 custom_perms = frappe.get_all(u'Custom DocPerm', fields=u'*', filters=dict(role=role))
 doctypes_with_custom_perms = list(set((p.parent for p in custom_perms)))
 for p in perms:
  if (p.parent not in doctypes_with_custom_perms):
   custom_perms.append(p)
 return p

def get_all_perms ( role ) : perms = frappe . get_all ( u'DocPerm' , fields = u'*' , filters = dict ( role = role ) ) custom_perms = frappe . get_all ( u'Custom DocPerm' , fields = u'*' , filters = dict ( role = role ) ) doctypes_with_custom_perms = list ( set ( ( p . parent for p in custom_perms ) ) ) for p in perms : if ( p . parent not in doctypes_with_custom_perms ) : custom_perms . append ( p ) return p
returns valid permissions for a given role .