|
|
|
|
|
by 5Qn8mNbc2FNCiVV
1923 days ago
|
|
Hasura makes that pretty easy as can be seen here: https://github.com/firatoezcan/hasura-cms This is also easy to do with self-written servers, maybe take a look at the metadata folder to get a gist of what Hasura would be doing behind the scenes (running a query and then checking the claim for the condition for the given field that permission wants to be requested for) (Just a repo I started one evening, it doesn't do much but the concept of projects with owners and collaborators should work) |
|
Looking at the SQL and metadata, does not look all that simple for such a simple case. The complex part is behind all that, written by Hasura.
Imaging what that would look like with Orgs, Groups, and User permissions all existing on a single object, or even resource type, and how a single email (user) could have permissions at all of these levels on any object. Then consider that GraphQL allows nested query objects, so am I listing the objects as a top-level query, or is the list from a 1 to many relation nested under another query, where the query parsing system now batches these subqueries and presents them to the resolver in a big log. You have to understand the context of the incoming queries in each resolver, and then make auth decisions about it.
Think about using Hasure vs writing the auth systems in Hasura. Or how complex things get when you want to implement auth for multi-tenant SaaS.