mikerhodes commented on issue #1554: Additional Mango-based update handler / 
VDU functionality
URL: https://github.com/apache/couchdb/issues/1554#issuecomment-415076268
 
 
   @wohali Yes, that's the basic logic. I think my condition logic is the wrong 
way around, because I would say that the `throw` happens if `condition` is 
false rather than if condition is true.
   
   ```js
   if (doc.type === "post") {   // i.e., "if <guard condition>"
     if (! (doc.author == userCtx.name)) {  // i.e., "if not <condition>"
       throw("you can't update other users' docs.")
     }
   }
   ```
   
   I can see that you could combine the guard and the condition into a single 
clause quite easily given they are both Mango selectors. I just find that the 
logical distinction of "the types of thing this authorisation decision applies 
to" (guard) and "the authorisation condition itself" (condition) makes things 
more clear.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to