-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Virtual ACL for Pointer<_Role>
field via CLP
#7926
Comments
Thanks for opening this issue!
|
@stephannielsen I think the parse server already supports your use case. You can create a Parse.Role with the name "admin", and then use it in your CLP like this. create: {
'role:admin': true,
}, Another example classLevelPermissions: {
find: { '*': true },
count: { requiresAuthentication: true },
get: { '*': true },
update: { 'role:Admin': true },
create: {},
delete: {},
addField: {},
protectedFields: {},
}, |
@stephannielsen feel free to close this issue if my answer is correct and fulfill your use case 🙂 |
@Moumouls thank you for the response but no, I don't think this covers our use case. Using a role in CLP would allow all users with that role allow to perform the The |
Thanks @stephannielsen for additional details, could you provide an example of the CLP object that you have in mind with the virtual pointer on role ? ( Like the one that I provided above ) |
Sure. I would expect it to look the same as it does for user pointer CLPs. Unfortunately, those are not documented to my knowledge with examples, but here is a PR for impoving the docs for them: parse-community/docs#700 Based on that it would look like this: {
"classLevelPermissions":
{
"get": {
"pointerFields": ["owner", "subscribers"] // Pointer<User>, Pointer<Role> or Array<Pointer<..>>
},
"find": {
"pointerFields": ["owner", "subscribers"]
},
"create":{
"*": true
},
"update": {
"pointerFields": ["owner"]
},
"delete": {
"pointerFields": ["owner"]
}
}
} Or grouped: {
...,
"classLevelPermissions":
{
"create":{
"*": true
},
// notice these are root level properties:
"readUserFields": ["owner", "subscribers"],
"writeUserFields": ["owner"]
},
} To be honest - I have not used CLP pointers yet and I even just failed to configure a pointer CLP on a test class via the dashboard. |
New Feature / Enhancement Checklist
Current Limitation
I am currently improving the authorization model of our application and researched in-depth what Parse offers and how I can leverage it in the best way. Our app basically provides a multi-tenant setup where users belong to a certain tenant and only have access to the data of that tenant. A user can have access data to multiple tenants. We plan on using a
_Role
for each tenant. This means, on each object we need to set the ACL for the object to that tenant role. That's fine and not a big deal, but I came across the virtual ACLs one can create by using a CLP for aPointer<_User>
. This kind of virtual ACL defined on CLP level is basically what we require - just not for a specific_User
but for a specific_Role
.Feature / Enhancement Description
The idea for the enhancement would be to allow the pointer CLPs to either reference a
_User
(current state) or a_Role
. Using a role pointer would then also create a virtual ACL for each object for that class.Example Use Case
Apps with multi-tenant setup to separate data between tenants. Tenants can be represented as roles.
Alternatives / Workarounds
Use ACLs and set the ACL for a tenant
_Role
explicitly on each object for a class.3rd Party References
No, but also have only limited experiences with other providers.
The text was updated successfully, but these errors were encountered: