Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internal function _getInheritedRoleNames() should return role object #304

Open
SimonSimCity opened this issue Dec 10, 2019 · 0 comments
Open
Labels
enhancement good first issue This is an easy issue that beginners can tackle to get to know the code base.

Comments

@SimonSimCity
Copy link
Member

_getInheritedRoleNames: function (role) {
const inheritedRoles = new Set()
const nestedRoles = new Set([role])
nestedRoles.forEach(r => {
const roles = Meteor.roles.find({ _id: { $in: r.children.map(r => r._id) } }, { fields: { children: 1 } }).fetch()
roles.forEach(r2 => {
inheritedRoles.add(r2._id)
nestedRoles.add(r2)
})
})
return [...inheritedRoles]
},

The function _getInheritedRoleNames() is currently used to construct the array inheritedRoles on a role-assignment, where it only takes over the parameter _id. If you have data stored on the role, wouldn't it be better to have it copied along?

If one of these parameter changes, the programmer extending this package would then be responsible for also keeping this data updated there. If he doesn't need it there, he can extend this package wrapping this function to remove the additional properties.

@SimonSimCity SimonSimCity added enhancement good first issue This is an easy issue that beginners can tackle to get to know the code base. labels Dec 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement good first issue This is an easy issue that beginners can tackle to get to know the code base.
Projects
None yet
Development

No branches or pull requests

1 participant