sails-permissions icon indicating copy to clipboard operation
sails-permissions copied to clipboard

User permission have the relation set to "role"

Open sylvainlap opened this issue 9 years ago • 2 comments

When I create a Permission linked to a user, the "relation" attribute is set to "role", instead of "user". Example:

Permission: {
    "model": "560a8c5c82b8e74f11e46938",
    "user": "560a8ebb80d3f401134a1488",
    "action": "create",
    "relation": "role",
    "createdAt": "2015-09-29T13:14:35.929Z",
    "updatedAt": "2015-09-29T13:14:35.929Z",
    "id": "560a8ebb80d3f401134a14ca"
  }

sylvainlap avatar Sep 30 '15 08:09 sylvainlap

How are you creating the permission?

ryanwilliamquinn avatar Oct 11 '15 14:10 ryanwilliamquinn

Thanks to PermissionService.grant().

PermissionService.grant([
    { user: user.id, model: "post", action: "create" },
    { user: user.id, model: "post", action: "read" },
...

sylvainlap avatar Oct 12 '15 07:10 sylvainlap