コード例 #1
0
ファイル: project_users.py プロジェクト: altai/altai-api
def add_project_user(project_id):
    user_id = parse_request_data(required=_SCHEMA.required)['id']
    tenant = get_tenant(project_id)
    user = _get_user(user_id)
    set_audit_resource_id(user_id)

    try:
        tenant.add_user(user.id, member_role_id())
    except osc_exc.NotFound:
        user = _get_user(user_id)  # check that user still exists
        abort(404)  # if user still exists, tenant was removed

    return make_json_response(link_for_user(user))
コード例 #2
0
def add_project_user(project_id):
    user_id = parse_request_data(required=_SCHEMA.required)['id']
    tenant = get_tenant(project_id)
    user = _get_user(user_id)
    set_audit_resource_id(user_id)

    try:
        tenant.add_user(user.id, member_role_id())
    except osc_exc.NotFound:
        user = _get_user(user_id)  # check that user still exists
        abort(404)  # if user still exists, tenant was removed

    return make_json_response(link_for_user(user))
コード例 #3
0
ファイル: project_users.py プロジェクト: altai/altai-api
def get_project_user(project_id, user_id):
    for user in _project_users_list(project_id):
        if user.id == user_id:
            return make_json_response(link_for_user(user))
    abort(404)
コード例 #4
0
ファイル: project_users.py プロジェクト: altai/altai-api
def list_project_users(project_id):
    parse_collection_request(_SCHEMA)
    result = [link_for_user(user) for user in _project_users_list(project_id)]
    parent_href = url_for('projects.get_project', project_id=project_id)
    return make_collection_response(u'users', result, parent_href=parent_href)
コード例 #5
0
def get_project_user(project_id, user_id):
    for user in _project_users_list(project_id):
        if user.id == user_id:
            return make_json_response(link_for_user(user))
    abort(404)
コード例 #6
0
def list_project_users(project_id):
    parse_collection_request(_SCHEMA)
    result = [link_for_user(user) for user in _project_users_list(project_id)]
    parent_href = url_for('projects.get_project', project_id=project_id)
    return make_collection_response(u'users', result, parent_href=parent_href)