Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Figure out how to deal with object level permissions #144

Open
sergei-maertens opened this issue Jan 4, 2021 · 0 comments
Open

Figure out how to deal with object level permissions #144

sergei-maertens opened this issue Jan 4, 2021 · 0 comments
Assignees

Comments

@sergei-maertens
Copy link
Contributor

Currently, the ZAC backend checks object-level permissions (the permissions themselves are managed through authorization profiles/roles).

They are scoped on the zaak.zaaktype and zaak.vertrouwelijkheidaanduiding, mostly.

For collections, the backend (API) can filter out the results that are only relevant for the authenticated user. The same goes for retrieving an object or attempting an action on it - the backend will verify these permissions and throw a HTTP 403 error if the user does not have the appropriate permissions.

However, the frontend needs to know which permissions the user has or doesn't have, in order to be able to properly show the relevant UI controls (.e.g. don't show the "add file" button if the user doesn't have permission for this).

What's the best way to get those permissions from the backend to the frontend?

  1. Include them in the JSON response, under a _permissions key? E.g.

        "id": "123",
        "zaaktype": "...",
        "_permissions": {
            "zaakproces:usertasks-uitvoeren": false,
            "zaken:add-documents": true,
            "zaken:toegang-verlenen": false,
        }
  2. Have a dedicated endpoint for permission checks: GET /api/permissions?object=https://openzaak.utrechtproeftuin.nl/...&objectType=zaak. Possibly this could include a detail-resource to check a single permission, and might be more suited to the component approach where each component checks its own permission(s).

  3. Communicate the permissions through headers as to not polute the response body? This can get unwieldly though, and header parsing isn't particularly fun. It also doesn't account for getting the permissions for each object in a collection of objects.

  4. Any other options?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants