Skip to content

Nested roles #2256

@alvarp

Description

@alvarp

Hi,

Maybe it's a misunderstanding of this, but in theory, loopback can handle a user having a role, mapped to another role, which have an ACL allowing it to do something. This isn't working for me.

There's the role "model_read" mapped to a user through "onerole", but the user cannot make use of the ACLs assigned to "model_read".

Role Collection

{ 
    "_id" : ObjectId("571dd32a8cea6408067e8df3"), 
    "name" : "model_read", 
    "created" : ISODate("2016-04-25T08:19:54.854+0000"), 
    "modified" : ISODate("2016-04-25T08:19:54.854+0000")
}
{ 
    "_id" : ObjectId("571dd3358cea6408067e8df4"), 
    "name" : "onerole", 
    "created" : ISODate("2016-04-25T08:20:05.905+0000"), 
    "modified" : ISODate("2016-04-25T08:20:05.905+0000")
}

RoleMapping Collection

{ 
    "_id" : ObjectId("571dd99a25dea8502e5aaba4"), 
    "principalType" : "ROLE", 
    "principalId" : "571dd3358cea6408067e8df4", 
    "roleId" : ObjectId("571dd32a8cea6408067e8df3")
}
{ 
    "_id" : ObjectId("571ddbe50e0c2a84166d2c79"), 
    "principalType" : "USER", 
    "principalId" : "5718bbc2c134dce41909e74b", 
    "roleId" : ObjectId("571dd3358cea6408067e8df4")
}

And then, in the model ACLs I've this:

  "acls": [
    {
      "accessType": "*",
      "permission": "DENY",
      "principalType": "ROLE",
      "principalId": "$everyone"
    },
    {
      "accessType": "READ",
      "principalType": "ROLE",
      "principalId": "model_read",
      "permission": "ALLOW",
      "property":"findById"
    }
  ]

The user 5718bbc2c134dce41909e74b only can access to the model if I set the principalId of the ALLOW ACL to onerole, if I set to model_read as in the example, it doesn't allow me to findById. I guess that I'm doing something wrong or there is a bug, because the linked docs above explains that a role can map to a role.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions