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)

Updated `package.json` so that required hubot version goes from ^2.7.5
to ^2.14.0
  • Loading branch information
msabramo committed Oct 25, 2015
1 parent b30ed6f commit 1a5cfaa
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"grunt-contrib-watch": "~0.5.3",
"grunt-mocha-test": "~0.7.0",
"grunt-release": "~0.6.0",
"hubot": "^2.7.5",
"hubot": "^2.14.0",
"hubot-mock-adapter": "^1.0.0",
"matchdep": "~0.1.2",
"mocha": "*"
Expand Down
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 1a5cfaa

Please sign in to comment.