Skip to content

Commit 1a5cfaa

Browse files
committed
Add groups function to user object
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
1 parent b30ed6f commit 1a5cfaa

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"grunt-contrib-watch": "~0.5.3",
4040
"grunt-mocha-test": "~0.7.0",
4141
"grunt-release": "~0.6.0",
42-
"hubot": "^2.7.5",
42+
"hubot": "^2.14.0",
4343
"hubot-mock-adapter": "^1.0.0",
4444
"matchdep": "~0.1.2",
4545
"mocha": "*"

src/auth.coffee

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ config =
2626
admin_list: process.env.HUBOT_AUTH_ADMIN
2727

2828
module.exports = (robot) ->
29+
robot.listenerMiddleware (context, next, done) ->
30+
context.response.message.user.groups = (cb) ->
31+
cb(robot.auth.userRoles(context.response.message.user))
32+
next()
2933

3034
unless config.admin_list?
3135
robot.logger.warning 'The HUBOT_AUTH_ADMIN environment variable not set'

0 commit comments

Comments
 (0)