In the current Roles model, the getRoles method returns the id when fetching role mappings via principal. It would be nice it resolved this to the actual role name.
This requires more callbacks to track in inRoleTasks but shouldn't be too difficult to add the calls in.
@greaterweb would you mind submitting a pull request implementing this change?
BTW when building github URLs to code, press "y" before copying the URL. That way a commit sha is appended to the URL and it will keep working even when the file is moved around, as happened in this case. I have fixed the issue description for you, please check that the line numbers are still correct.
Closing.
@batjos: would you know if this feature request has been considered, or will be at some point? It would indeed be nice that getRoles return actual role names rather than their ids
referring to this url
this simple modification would do the trick
if (principalType && principalId) {
// Please find() treat undefined matches all values
inRoleTasks.push(function(done) {
roleMappingModel.find({
where: {principalType: principalType, principalId: principalId},
include: ['role']
}, function(err, mappings) {
debug('Role mappings found: %s %j', err, mappings);
if (err) {
if (done) done(err);
return;
}
mappings.forEach(function(m) {
var _m = m.toJSON();
addRole(_m.role.name);
});
if (done) done();
});
});
}
Most helpful comment
referring to this url
this simple modification would do the trick