示例#1
0
def add_group(args):
    group_name = _to_group_name(args.name)
    io.start('Adding group %s' % highlight(group_name))
    post(api.group(), data={'name': group_name, 'label': args.name})
def _delete_package(args):
    if args.force or (not args.force and mcmd.io.ask.confirm(
            'Are you sure you want to delete package {} and all of its contents?'
            .format(args.resource))):
        io.start('Deleting package {}'.format(highlight(args.resource)))
        _delete_rows(ResourceType.PACKAGE.get_entity_id(), [args.resource])
def enable_language(args):
    io.start('Enabling language {}'.format(highlight(args.language)))
    url = api.rest1('sys_Language/{}/active'.format(args.language))
    put(url, 'true')
def enable_rls(args):
    io.start('Enabling row level security on entity type %s' %
             highlight(args.entity))

    ensure_resource_exists(args.entity, ResourceType.ENTITY_TYPE)
    security.enable_row_level_security(args.entity)
def _update_group_role_membership(user: User, group: Group, role: Role):
    io.start('Making user {} a member of role {}'.format(
        highlight(user.username), highlight(role.name)))
    url = urljoin(api.member(group.name), user.username)
    put(url, data=json.dumps({'roleName': role.name}))
def _add_group_role_membership(user: User, group: Group, role: Role):
    io.start('Making user {} a member of role {}'.format(
        highlight(user.username), highlight(role.name)))
    url = api.member(group.name)
    post(url, data={'username': user.username, 'roleName': role.name})
def _make_member_of_role(role, user):
    if _is_member(user, role):
        io.info('User {} is already a member of role {}'.format(
            highlight(user.username), highlight(role.name)))
    else:
        _add_role_membership(user, role)
示例#8
0
def enable_rls(args):
    io.start('Enabling row level security on entity type %s' %
             highlight(args.entity))

    ensure_resource_exists(args.entity, ResourceType.ENTITY_TYPE)
    post(api.rls(), data={'id': args.entity, 'rlsEnabled': True})
def _switch_to_new_host(url):
    if ask.confirm("Do you want to switch to the new host?"):
        io.start("Switching to host {}".format(highlight(url)))
        config.set_host(url)