I'm using alanning roles for setting up roles and groups. I currently have a method that allows to change the role of a user and it works perfectly. I use similar syntax to set the group for a user and I don't get any errors on the console and it spits my object as indicated below, however when I check the database no groups have been added to this user. I tried several things thus far to no success. Either my check throws an error or no errors but no update on the user object. What am I not seeing here?
Comes from this form...
<select {{disableIfAdmin _id}} name="userGroup" class="form-control">
<option selected="{{selected group.[0] 'wazzio'}}" value="wazzio">Wazzio</option>
<option selected="{{selected group.[0] 'estore'}}" value="estore">E-store</option>
<option selected="{{selected group.[0] 'customer'}}" value="customer">Customer</option>
</select>
Object created...
Object {user: "ZgxC4K6qhx5zXht88", roles: "sales", group: "estore"}
This is the event listener to wait for a selection to call the method:
'change [name="userGroup"]': function( event, template ) {
var group = $( event.target ).find( 'option:selected' ).val();
Meteor.call( "setGroupOnUser", {
user: this._id,
roles: this.roles[0],
group: group
});
}
This is the method that is suppose to set the group to this user:
setGroupOnUser: function( options ) {
console.log(options);
check( options, {
user: String,
roles: String,
group: String
});
try {
Roles.setUserRoles( options.user, [options.roles], options.group);
} catch ( exception ) {
return exception;
}
}
It throws this errror in the catch exception:
MinimongoError: can't append to array using string field name [estore] [409]"