Skip to content

Commit

Permalink
Add groups function to user object
Browse files Browse the repository at this point in the history
Useful so that hubot-auth can be used with
[hubot-approval](https://github.com/michaelansel/hubot-approval)
  • Loading branch information
msabramo committed Oct 24, 2015
1 parent b30ed6f commit 4bf5e17
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/auth.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ config =
admin_list: process.env.HUBOT_AUTH_ADMIN

module.exports = (robot) ->
robot.listenerMiddleware (context, next, done) ->
context.response.message.user.groups = (cb) ->
cb(robot.auth.userRoles(context.response.message.user))
next()

unless config.admin_list?
robot.logger.warning 'The HUBOT_AUTH_ADMIN environment variable not set'
Expand Down

0 comments on commit 4bf5e17

Please sign in to comment.