Created
December 18, 2012 23:26
-
-
Save anonymous/4333045 to your computer and use it in GitHub Desktop.
What would this function look like with addAdminUser, db.addUser and dbUser.setPermissions taking two callbacks?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# add an admin user. cb will receive an error | |
# (or null if there isn't a problem) and a | |
# flag indicating success | |
addAdminUser = ( username, cb ) -> | |
db.addUser username, ( err, dbUser ) -> | |
return cb err if err | |
dbUser.setPermissions "admin", ( err, dbPermission ) -> | |
return cb err, false if err | |
return cb null, true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment