Return-Path: X-Original-To: apmail-couchdb-user-archive@www.apache.org Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 760FD6ECB for ; Mon, 13 Jun 2011 19:38:26 +0000 (UTC) Received: (qmail 91166 invoked by uid 500); 13 Jun 2011 19:38:24 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 91022 invoked by uid 500); 13 Jun 2011 19:38:24 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 91014 invoked by uid 99); 13 Jun 2011 19:38:24 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 13 Jun 2011 19:38:24 +0000 X-ASF-Spam-Status: No, hits=1.8 required=5.0 tests=FREEMAIL_FROM,HTML_FONT_FACE_BAD,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of travis.jensen@gmail.com designates 209.85.210.52 as permitted sender) Received: from [209.85.210.52] (HELO mail-pz0-f52.google.com) (209.85.210.52) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 13 Jun 2011 19:38:17 +0000 Received: by pzd13 with SMTP id 13so685115pzd.11 for ; Mon, 13 Jun 2011 12:37:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:from:date :x-google-sender-auth:message-id:subject:to:content-type; bh=d/BZGHhGmmsf4euL9QTgS4utOyofCrj2eR+25B0PmzY=; b=oQaLLMe1NAUOO6cKXZNaelJ//8DzZoinWctHBX6CkKZ+oNSIQIwxMbkJAfMdI9us9N acFwVeFdDbR9Lu96qaI3Bs1MFcce439/5ofvwmcjUfsC+mDdJddSN+D5I6cz8w7LRYVB dDs8wbwBG4gZxEG/ay4b5qAEy2etTiohs9xHg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:from:date:x-google-sender-auth:message-id :subject:to:content-type; b=rw6vj+U6wcwip+1W7467LBhTbnp7ECEAcYFrnwtVp89DkCMQFWswap1f0ylnVdij8q HatM0x0et7azMxvtF0+tvSHNdAQWKtyPJY/GuaH9DDEs+H0ToGSAG3rgLSnhP/zys43D jB2xsHK3TGoqac7fEPvtIbmM1/nwjkQjqfmt0= Received: by 10.68.47.196 with SMTP id f4mr2546505pbn.363.1307993875134; Mon, 13 Jun 2011 12:37:55 -0700 (PDT) MIME-Version: 1.0 Sender: travis.jensen@gmail.com Received: by 10.68.58.200 with HTTP; Mon, 13 Jun 2011 12:37:25 -0700 (PDT) From: Travis Jensen Date: Mon, 13 Jun 2011 13:37:25 -0600 X-Google-Sender-Auth: 8b6q3MJp8-u0m0R3FqIDtHJI_go Message-ID: Subject: Handling ACLs To: user@couchdb.apache.org Content-Type: multipart/alternative; boundary=bcaec51a73204bb74304a59d0eff X-Virus-Checked: Checked by ClamAV on apache.org --bcaec51a73204bb74304a59d0eff Content-Type: text/plain; charset=ISO-8859-1 Hi, all, I'm trying to figure out the best way to manage what can best be described as ACLs inside of couch. The best example I've got is to think about documents as emails. A message has an owner (the sender aka From), a list of recipients (the To and Cc fields), and a list of blind recipients (the Bcc field). Just like in email, everybody can see the From, To, and Cc fields. Members of the Bcc field can only see themselves and not other Bcc recipients. I've trying to figure out the best method of storing this ACL information. My original thought was to store something like this, having a validation function test that the user exists in one of the groups: { "from": "...", "to": [ "...", "..." ], "cc": [ "...", "..." ], "bcc": [ "...", "..." ], "subject": "...", "body": "..." } The problem with this is that somebody in the "to" list gets to see everybody in the "bcc" list. (Also, while it seems bad to mix meta data with real data, my actual application will not be doing this. This entire document is meta-data, with the real document being attached to this meta-data). So then I thought about using separate documents to track the ACLs, with a pointer to the actual document. Then the "bcc" people could be separated from the "to" and "cc" people. For example: { "_id": "abcd-1234-...", "type": "message", "subject": "...", "body": "..." } { "type": "acl", "message": "abcd-1234-...", "to": ["...", "..."], "cc": ["...", "..."] } { "type": "acl", "message": "abcd-1234-...", "bcc": "..." } The problem there is that I need to run a query to figure out whether somebody is allowed access to the document ("get all documents where type="acl" and message="abcd-1234-...."). I'm fairly new to CouchDB, so I'm not sure if that is a bad thing or not. The final solution I thought of is to use the first document format, but prohibit access to the document directly using GET requests (except for replication requests). All GET access would require using a show function that strips out the bcc's that shouldn't be seen. The problem I see with this is that, while emails are read-only, my documents aren't actually read-only. This means I've got to figure out how to make sure all the right bcc people get re-inserted into the document if a "to" or "cc" updates the document, since they can't see the bcc field. Is there a fourth option I'm not seeing or is the second option not as bad as I'm thinking? How would you handle this? Thanks. tj -- *Travis Jensen* ***Product Manager* *ClickLock * * * ***travis@clicklock.com * *801 755 7362* *http://clicklock.com * --bcaec51a73204bb74304a59d0eff--