meteor-restivus icon indicating copy to clipboard operation
meteor-restivus copied to clipboard

Update roleGroup 87a3da4

Open fducom opened this issue 8 years ago • 3 comments

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

fducom avatar Dec 12 '16 02:12 fducom

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.

kahmali avatar Jan 22 '17 04:01 kahmali

hello, so is current version supporting group?? thx

fly19890211 avatar May 14 '17 07:05 fly19890211

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.

Slind14 avatar Sep 25 '17 01:09 Slind14