Skip to content

Middleware for managing peer approvals of Hubot commands

Notifications You must be signed in to change notification settings

Nothingtoloose/hubot-approval

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hubot-approval

Middleware for managing peer approvals of Hubot commands

See src/approval.coffee for full documentation.

Installation

In hubot project repo, run:

npm install hubot-approval --save

Then add hubot-approval to your external-scripts.json:

[
  "hubot-approval"
]

Note that hubot-approval needs to be added after whatever module is adding the groups function to the User object.

Assumptions

hubot-approval assumes that there is a piece of middleware executing prior to it that modifies the User object to add a group lookup function (groups). A simple version is below:

robot.listenerMiddleware (context, next, done) ->
  context.response.message.user.groups = (cb) ->
    cb(robot.brain.get('userGroups')[context.response.message.user.name] or [])

Sample Interaction

user1>> hubot do something
hubot>> user1: I need approval for that from someone in 'admin'. In order to approve, say 'hubot approve cheese'.
user2>> hubot approve cheese
hubot>> user2: Approved! Executing 'hubot do something' for user1
hubot>> user1: I did something!

About

Middleware for managing peer approvals of Hubot commands

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • CoffeeScript 83.3%
  • JavaScript 10.6%
  • Shell 6.1%