Open
liady
opened this issue 2 years ago
•
7 comments
Projects visibility (private/public)
This PR adds the capability to define a project as public (open to all), or private (open only to owner).
This works with Okta's FGA, and is the foundation for adding inremental support for fine grained permissions.
Refer to our paper doc ("Multiplayer II: Fine Project! Grained Access?") for the detailed spec.
Implementation Contents
A new table was added to the database to save project's visibility status (currently PRIVATE, PUBLIC, WITH_LINK), and a matching definition was added in Prisma's schema.
Authorization model was written in Okta's FGA, to reflect the possible permissions.
Infrastructure for contacting Okta's FGA (fgaService), and a permissionsService that abstracts it.
When changing a project's visibility, we store it in our DB (for our usage), and also send a tuple to Okta that defines that user:* (which means "all users") have/doesn't have a viewer relation to the project, and the can_view permission is derived from it.
When calling our /project endpoint, a check is being made to see if there is a can_view permission for this project, and if not - a 404 page is being generated.
UI added - project visibility UI in the Projects page (menu and badge).
Tests that mock Okta's FGA service (since there is no official mocking for now)
@ruggi I agree, we should defintely have a middleware layer for endpoints. It was left out of this initial PR since it only handles the "can_view" permission (and not editing/collaborating).
@ruggi I agree, we should defintely have a middleware layer for endpoints. It was left out of this initial PR since it only handles the "can_view" permission (and not editing/collaborating).
sure, but I don't see a reason for not going for the better option right now – also considering that with this change in its current form we already introduce technical debt (and a behavior discrepancy between that route and any other route used by the editor and the BFF). As this is an introductory PR it feels like a great place for stubbing a very simple middleware that we can improve upon going forward, rather than modifying a route that will need to be re-changed later :)