Skip to content

User Roles not added to create or update calls #294

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

Closed
mtalma opened this issue Feb 8, 2016 · 1 comment
Closed

User Roles not added to create or update calls #294

mtalma opened this issue Feb 8, 2016 · 1 comment

Comments

@mtalma
Copy link

mtalma commented Feb 8, 2016

I have my _User class level permissions set up such an "Administrator" role can update any user's info. However when an "Administrator" attempts to update another user's info, I get a permissions error.

In RestWrite.js (line 649), we assign * and the user id to the acl array. Since we never assign Roles to the acl array, create and update queries fail with a permissions error for the "Administrator".

var options = {};
  if (!this.auth.isMaster) {
    options.acl = ['*'];
    if (this.auth.user) {
      options.acl.push(this.auth.user.id);
    }
  }

I propose the following edit to add the user roles to the acl:

var options = {};
  if (!this.auth.isMaster) {
    options.acl = ['*'];
    if (this.auth.user) {
        options.acl = options.acl.concat(this.auth.userRoles);
     }
  }

this.auth.userRoles seems to have all Roles associated with the current user plus their user id. Therefore this results in an array that looks like this: [ '*', 'role:Administrator', 'ZI7jszHWuI' ]

@gfosco
Copy link
Contributor

gfosco commented Feb 20, 2016

Should be fixed by the changes in #374 which will be in 2.1.3.

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

No branches or pull requests

2 participants