Add role.principals() and role.roles() to API docs
@crandmck
Cannot find API info of these two functions from the following code.
Line 50:
userRole.principals(function(err, principals) {
assert.equal(principals.length, 1);
});
userRole.roles(function(err, roles) {
assert.equal(roles.length, 1);
});
https://github.com/strongloop/loopback/blob/9a33602458712afecedd25062f02bd8b5c4e01a5/test/role.test.js
I don't know anything about these methods. I don't see them in the source code. I do see principals in the role.json file, so that might be the source of userRole.principals.
Someone in engineering (eg. @ritch) needs to take this and let me know if I need to add something to docs, and if so, what. I suspect it's not something that we should document, but I don't know for sure.
Those functions come from relations
@ritch I realize they come from relations, but if those relations are intrinsic to how roles work, then should we add those functions to the API docs?
Yes we should add them, similarly to how we've added the PersistedModel methods.
So it's been more than a year already. Any updates on where this is at?
I'll try to sort it out.
Any update on this? Looking for a way to programmatically remove users from the admin role. The docs only explain giving a user the admin role via Role.principals.create() but not taking it away again. Is there a principals.destroy() or principals.delete() or something like that to do that?
Nevermind, I'll persist RoleMapping to my datasource and work with that. I'll see if I can update the docs a little bit.