Assign roles to users and restrict command access in other scripts (and remember them on reload)
Last updated 3 years ago by jszaszvari .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install hubot-auth-persistent 
SYNC missed versions from official npm registry.

Hubot: hubot-auth

Build Status

This is a fork that simply contains a PR missing from the main repo that makes hubot-auth save roles into the brain and actually persist across reboots instead of clearing them. Props to the original authors Alex Williams (, alexwilliamsca, tombell and the author of the PR/Fix Dario Berzano (

Assign roles to users and restrict command access in other scripts.

See src/ for full documentation.


Add hubot-auth to your package.json file:

npm install --save hubot-auth

Add hubot-auth to your external-scripts.json:


Run npm install

Sample Interaction

user1>> hubot user2 has jester role
hubot>> OK, user2 has the jester role.

Sample Usage

Restricting commands

module.exports = (robot) ->
  # Command listener
  robot.respond /some command/i, (msg) ->
    role = 'some-role'
    user = robot.brain.userForName(
    return msg.reply "#{name} does not exist" unless user?
    unless robot.auth.hasRole(user, role)
      msg.reply "Access Denied. You need role #{role} to perform this action."
    # Some commandy stuff
    msg.reply 'Command done!'

Example Interaction

user2>> hubot some command
hubot>> Access Denied. You need role some-role to perform this action.
user1>> hubot user2 has some-role role
hubot>> OK, user2 has the some-role role.
user2>> hubot some command
hubot>> Command done!

Current Tags

  • 2.2.0                                ...           latest (3 years ago)

2 Versions

  • 2.2.0                                ...           3 years ago
  • 2.1.1                                ...           3 years ago
Maintainers (1)
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 3
Dependencies (1)
Dev Dependencies (10)
Dependents (0)

Copyright 2014 - 2016 © |