Skip to content

Commit

Permalink
only allow "forum" and admins to do stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
thejh committed Dec 30, 2011
1 parent 69fca55 commit c452405
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions couchdb/app.js
Expand Up @@ -10,6 +10,10 @@ var ddoc =

module.exports = ddoc

ddoc.validate_doc_update = function(newdoc, olddoc, userCtx, secobj) {
if (userCtx.name !== 'forum' && userCtx.roles.indexOf('_admin') === -1) throw {forbidden: 'you must be logged in as "forum" or an admin'}
}

ddoc.views.threadPosts =
{ map: function(doc) {
if (doc._id.slice(0, 5) === 'post:') {
Expand Down

0 comments on commit c452405

Please sign in to comment.