Esempio n. 1
0
def list_rights_available_in_vcd(extension_name):
    """List the rights existing on this vCD instance.

    Args:
        extension_name (str): Name of the current extension
    """
    rights = []
    client = login_as_system_admin()
    system_org = Org(client, resource=client.get_org())
    return system_org.list_rights_available_in_vcd()
Esempio n. 2
0
def list_rights(ctx, org_name, all):
    try:
        restore_session(ctx)
        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_vcd()
        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)
Esempio n. 3
0
def list_rights(ctx, org_name, all):
    try:
        restore_session(ctx)
        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_vcd()
        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)