summaryrefslogtreecommitdiff
path: root/opendc-web/opendc-web-api/opendc/api/v2/projects/projectId/authorizations/endpoint.py
blob: 1b2291223092b934ea865d56c2c055de9b57bb77 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
from opendc.models.project import Project
from opendc.util.rest import Response


def GET(request):
    """Find all authorizations for a Project."""

    request.check_required_parameters(path={'projectId': 'string'})

    project = Project.from_id(request.params_path['projectId'])

    project.check_exists()
    project.check_user_access(request.current_user['sub'], False)

    authorizations = project.get_all_authorizations()

    return Response(200, 'Successfully retrieved project authorizations', authorizations)