Example #1
0
def post_group(token_info: dict):
    json_body = request.json
    group = Group.create(json_body['group_id'],
                         statement=json_body.get('policy'),
                         creator=get_email_claim(token_info))
    group.add_roles(json_body.get(
        'roles', []))  # Determine what response to return if roles don't exist
    return make_response(f"New role {json_body['group_id']} created.", 201)
Example #2
0
def put_groups_users(token_info: dict, group_id):
    group = Group(group_id)
    resp, code = _modify_users(group, request)
    return make_response(jsonify(resp), code)
Example #3
0
def delete_group(token_info: dict, group_id):
    Group(group_id).delete_node()
    return make_response(f"{group_id} deleted.", 200)
Example #4
0
def get_groups_roles(token_info: dict, group_id: str):
    next_token, per_page = get_next_token(request.args)
    group = Group(group_id)
    return get_page(group.get_roles, next_token, per_page, 'roles')
Example #5
0
def get_group_users(token_info: dict, group_id: str):
    next_token, per_page = get_next_token(request.args)
    group = Group(group_id)
    return get_page(group.get_users_page, next_token, per_page, 'users')
Example #6
0
def put_group_policy(token_info: dict, group_id: str):
    group = Group(group_id)
    group.set_policy(request.json['policy'])
    return make_response(f"{group_id} policy modified.", 200)
Example #7
0
def get_group(token_info: dict, group_id: str):
    group = Group(group_id)
    return make_response(jsonify(group.get_info()), 200)