meteor-restivus
meteor-restivus copied to clipboard
Update roleGroup 87a3da4
roleGroup
Api.addRoute('getroleuser/:id', {authRequired: true, roleRequired: 'admin', roleGroup:'default-group'}, {
get: function () {
//old method
// if (!Roles.userIsInRole(this.urlParams.id, ['admin'], "default-group")) {
// throw new Meteor.Error(403, "Access denied")
// }
return Meteor.users.findOne(this.urlParams.id);
},
delete: {
roleRequired: ['author', 'admin'],
roleGroup:'default-group',
action: function () {
if (Meteor.users.remove(this.urlParams.id)) {
return {status: 'success', data: {message: ' removed'}};
}
return {
statusCode: 404,
body: {status: 'fail', message: ' not found'}
};
}
}
});
Hey @fducom,
Sorry for the insanely delayed response. If you'd like me to pull this in, please squash it down to a single commit, provide some tests to verify the functionality, and documentation in the README if you're up to the task.
If I don't hear back from you after a while (and who would I be to complain 😛 ), I'll go ahead and take care of it.
hello, so is current version supporting group?? thx
It would be great if the group could be based on a transmitted query param.
So users can only update their own data, without the need of manual validation.