def list_rights(ctx, org_name, all): try: client = ctx.obj['client'] if org_name is not None: org_href = client.get_org_by_name(org_name).get('href') else: org_href = ctx.obj['profiles'].get('org_href') org = Org(client, href=org_href) if all: right_records = org.list_rights_available_in_system() else: right_records = org.list_rights_of_org() for right in right_records: del right['href'] stdout(right_records, ctx) except Exception as e: stderr(e, ctx)