Added 'github' permission type to allow access to CLAs view.

This commit is contained in:
Nick Winter 2014-12-14 13:37:43 -08:00
parent 39cee01ba8
commit 753acb1299

View file

@ -7,7 +7,7 @@ hipchat = require '../hipchat'
module.exports.setup = (app) ->
# This is hacky and should probably get moved somewhere else, I dunno
app.get '/db/cla.submissions', (req, res) ->
return errors.unauthorized(res, 'You must be an admin to view that information') unless req.user?.isAdmin()
return errors.unauthorized(res, 'You must be an admin to view that information') unless req.user?.isAdmin() or ('github' in req.user?.permissions ? [])
res.setHeader('Content-Type', 'application/json')
collection = mongoose.connection.db.collection 'cla.submissions', (err, collection) ->
return log.error "Couldn't fetch CLA submissions because #{err}" if err
@ -26,7 +26,7 @@ module.exports.setup = (app) ->
parts = module.split('/')
module = parts[0]
return getSchema(req, res, module) if parts[1] is 'schema'
if (not req.user) and req.route.method isnt 'get'
if (not req.user) and req.route.method isnt 'get'
return errors.unauthorized(res, 'Must have an identity to do anything with the db. Do you have cookies enabled?')
try