{"action":"created","issue":{"url":"https://api.github.com/repos/alanning/meteor-roles/issues/262","repository_url":"https://api.github.com/repos/alanning/meteor-roles","labels_url":"https://api.github.com/repos/alanning/meteor-roles/issues/262/labels{/name}","comments_url":"https://api.github.com/repos/alanning/meteor-roles/issues/262/comments","events_url":"https://api.github.com/repos/alanning/meteor-roles/issues/262/events","html_url":"https://github.com/alanning/meteor-roles/issues/262","id":341265645,"node_id":"MDU6SXNzdWUzNDEyNjU2NDU=","number":262,"title":"Check if userIsInRole, no matter the group","user":{"login":"bolognese","id":34416326,"node_id":"MDQ6VXNlcjM0NDE2MzI2","avatar_url":"https://avatars2.githubusercontent.com/u/34416326?v=4","gravatar_id":"","url":"https://api.github.com/users/bolognese","html_url":"https://github.com/bolognese","followers_url":"https://api.github.com/users/bolognese/followers","following_url":"https://api.github.com/users/bolognese/following{/other_user}","gists_url":"https://api.github.com/users/bolognese/gists{/gist_id}","starred_url":"https://api.github.com/users/bolognese/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bolognese/subscriptions","organizations_url":"https://api.github.com/users/bolognese/orgs","repos_url":"https://api.github.com/users/bolognese/repos","events_url":"https://api.github.com/users/bolognese/events{/privacy}","received_events_url":"https://api.github.com/users/bolognese/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-07-14T20:30:51Z","updated_at":"2018-07-14T22:35:27Z","closed_at":null,"author_association":"NONE","body":"Something like `Roles.userIsInRole(Meteor.userId(), 'my-role', Roles.ANY_GROUP)` would be a great feature.\r\n\r\nFor example, say you're building a forum. You have moderators that only have access to some parts of the forum.\r\nAnd you want to know if the current user is a moderator or not, no matter what his group is just to give him access to special features"},"comment":{"url":"https://api.github.com/repos/alanning/meteor-roles/issues/comments/405054235","html_url":"https://github.com/alanning/meteor-roles/issues/262#issuecomment-405054235","issue_url":"https://api.github.com/repos/alanning/meteor-roles/issues/262","id":405054235,"node_id":"MDEyOklzc3VlQ29tbWVudDQwNTA1NDIzNQ==","user":{"login":"bolognese","id":34416326,"node_id":"MDQ6VXNlcjM0NDE2MzI2","avatar_url":"https://avatars2.githubusercontent.com/u/34416326?v=4","gravatar_id":"","url":"https://api.github.com/users/bolognese","html_url":"https://github.com/bolognese","followers_url":"https://api.github.com/users/bolognese/followers","following_url":"https://api.github.com/users/bolognese/following{/other_user}","gists_url":"https://api.github.com/users/bolognese/gists{/gist_id}","starred_url":"https://api.github.com/users/bolognese/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bolognese/subscriptions","organizations_url":"https://api.github.com/users/bolognese/orgs","repos_url":"https://api.github.com/users/bolognese/repos","events_url":"https://api.github.com/users/bolognese/events{/privacy}","received_events_url":"https://api.github.com/users/bolognese/received_events","type":"User","site_admin":false},"created_at":"2018-07-14T22:35:27Z","updated_at":"2018-07-14T22:35:27Z","author_association":"NONE","body":"A simple (but really not optimized) way to do this would be something like :\r\n```\r\n_.extend(Roles, userHasRoleOrIDontKnowWhat = (user, role) => {\r\n\tconst roles = Meteor.users.findOne(user, {\r\n\t\tfields: { roles: 1 }\r\n\t}).roles\r\n\treturn _.contains(_.flatten(_.values(roles)), role)\r\n})\r\n```"}}
{"actor":{"display_login":"bolognese"}}