couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Travis Paul ...@visPaul.me>
Subject Re: commonjs in validation docs
Date Mon, 03 Jun 2013 12:49:37 GMT
Ok, I feel better now. I saw Stephen's question last night and was about to
respond but was really confused after seeing those that docs.
Are those docs maintained by Apache or the community? Just wondering, I
haven't seen them before.

Thanks


On Mon, Jun 3, 2013 at 4:12 AM, Alexander Shorin <kxepal@gmail.com> wrote:

> On Mon, Jun 3, 2013 at 11:50 AM, Stephen Bartell <snbartell@gmail.com>
> wrote:
> > So then am I out of luck when it comes to requires in my validation docs?
>
> Why so? I'd a bit modified the example to remove views confusion:
>
> {
>    "_id": "_design/test",
>    "lib": {
>        "security": "function user(userctx, secobj){\n  return {\n
> is_admin: function(){ return userctx.roles.indexOf('_admin') !== -1 }
>   \n  }  \n}\nexports.user = user;"
>    },
>    "validate_doc_update": "function(newdoc, olddoc, userctx, secobj)
> {\n  user = require('lib/security').user(userctx, secobj);\n  if
> (!user.is_admin()) { throw({forbidden: '_admin role required'}) };\n}"
> }
>
> I believe the docs example is needed to be completely rewritted.
>
>
> --
> ,,,^..^,,,
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message