couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Candler <B.Cand...@pobox.com>
Subject Re: A thought: view access controls
Date Wed, 20 Jan 2010 21:12:55 GMT
On Wed, Jan 20, 2010 at 10:09:31AM -0800, Chris Anderson wrote:
> I think this is by far the simplest solution. It does have a lot of
> space overhead (if you have rows that are readable by lots of distinct
> roles/users).
> 
> This would probably be a design doc option:
> 
> view_access_control : {
>   foo : true,
>   bar : false
> }

It may make sense to define it per view, perhaps like this:

  "views":{
    "foo":{
      "map":"...",
      "reduce":"...",
      "limit":"function(userCtx) { ... }"
    }
  }

The suggestion here is that the 'limit' function takes a userCtx and returns
a set of allowed key ranges for this view.

But it may be better to take the actual query as a parameter, and turn the
keys into their prefixed form.  If this were done server-side then the
client would be unable to construct any query which accessed key ranges they
didn't have rights to, so there's no need to do any intersection. It would
make the client code simpler too.

Regards,

Brian.

Mime
View raw message