-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Description
-
In an application, one user often have multi roles at the same time, at a screen.
Let's say, in a blog application, both editor and author could edit a post. So if a user is both an editor and an author, how to authenticate with hasura then ?
In this case, hasura should support multi-roles in headers:x-hasura-rolesinstead ofx-hasura-role.
Else how do you decide which role the user should use ? Because all roles are equal and valid. -
What i mean by multi-roles query is that.
query {
table1 {
field1
}
table2 {
field2
}
Suppose that user has roles role1 for table1, and role2 for table2 .
This is currently impossible to make above query.
- OK, what's if a websocket connection is made by above query. Now the user's role changed, what happen ?
The websocket connection should not be recreated for that. Instead the subscription data should reflect the change after that.
And this is the second hard part to solve this problem (when roles change for a subscription query)
- Suggested implementation (per @coco98 )
The query now should look like this
query {
asUser {
someTable {...}
}
asManager {
someTable {...}
}
}
Note 2 : My proposed solution
In Console UI for permission setting, there must be ability to assign current permission to another roles in system (or creation new role).
Only then that, Hasura could validate one role or array of roles query to resolve correct data to return.