You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The sails-permissions RolePolicy seems to not like that combination. The RolePolicy will actually extract ALL objects in my User model to check wether my permission matches each object. After some debug statements this is what is written to the console:
silly: PermissionService -> findModelPermissions -> permissionCriteria:
silly: {"model":8,"action":"read","or":[{"role":[2,5]},{"user":3}]}
silly: PermissionPolicy:
silly: [{"criteria":[],"model":8,"role":2,"action":"read","relation":"owner","createdAt":"2017-08-17T11:12:44.344Z","updatedAt":"2017-08-17T11:12:44.344Z","id":120}]
silly: PermissionPolicy: 1 permissions grant GET on model User for Greenfield Bikes/Bjarne B
To this point the PermissionPolicy has gathered that the current user has READ on User model with Relation: Owner
The RolePolicy calls the PermissionService.findTargetObjects(req) which returns ALL objects on the User model.
Why do the RolePolicy work on the User model, when it is the Preferences model that my UserController will access,
Why is the PermissionService.findTargetObjects(req) call needed? Returning all objects on the model seems crazy. What happens with performance if I have 100.000 entries in my model. And all this is before my code is even touching the model.
Am I using it all wrong?
The text was updated successfully, but these errors were encountered:
Hello
I have a method "preferences" on my
UserController
, which actually only works against myPreferences
model:The sails-permissions
RolePolicy
seems to not like that combination. TheRolePolicy
will actually extract ALL objects in myUser
model to check wether my permission matches each object. After some debug statements this is what is written to the console:To this point the
PermissionPolicy
has gathered that the current user hasREAD
onUser
model withRelation: Owner
Now comes the weird part:
The
RolePolicy
calls thePermissionService.findTargetObjects(req)
which returns ALL objects on theUser
model.Why do the
RolePolicy
work on theUser
model, when it is thePreferences
model that myUserController
will access,Why is the
PermissionService.findTargetObjects(req)
call needed? Returning all objects on the model seems crazy. What happens with performance if I have 100.000 entries in my model. And all this is before my code is even touching the model.Am I using it all wrong?
The text was updated successfully, but these errors were encountered: