Skip to content

Conversation

@fducom
Copy link

@fducom fducom commented Dec 12, 2016

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'}
                };
            }
        }
    });

@kahmali
Copy link
Owner

kahmali commented Jan 22, 2017

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.

@fly19890211
Copy link

hello, so is current version supporting group??
thx

@Slind14
Copy link

Slind14 commented Sep 25, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants