Meteor-Community-Packages / meteor-roles

Authorization package for Meteor, compatible with built-in accounts packages
http://meteor-community-packages.github.io/meteor-roles/
MIT License
921 stars 167 forks source link

Not getting results from getRolesForUser or getGroupsForUser when providing array #219

Closed bmcgonag closed 4 years ago

bmcgonag commented 7 years ago

When I provide an array of groups while trying to get Roles for a user with

Roles.getRolesForUser(this._id, ['Admin', 'GeneralUser'])

I just get

[]

back as the result.

If I make the request with only one value like

Roles.getRolesForUser(this._id, 'Admin')

I get the correct value back. Am I doing something improperly?

bmcgonag commented 7 years ago

@alanning Also wanted to ask...when I get back ressults as stated above, I get all roles in comma separated form, but can't seem to figure out how to iterate through them.

I setup a helper like this.

getUserRoles: function () {
    return Roles.getRolesForUser( this._id, 'Admin');
},

Then in template I do something like

{{#each getUserRoles}}
    {{roles}}
{{/each}}

No results come up.

I only get comma separated lest from {{getUserRoles}}

Thanks for any help and / or advice.

mitar commented 4 years ago

Please provide a reproduction with the latest version of the package. I can reopen the issue then.