@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.

[ Full content available at: https://github.com/apache/couchdb/issues/1554 ]
This message was relayed via gitbox.apache.org for [email protected]

Reply via email to