[Xapian-discuss] Filtering documents by permissions in PHP

Olly Betts olly at survex.com
Wed Jul 15 13:42:26 BST 2009


On Wed, Jul 15, 2009 at 10:16:27AM +0200, Ví?a Pl?ek wrote:
> Is somehow possible to subclass Deciders or overide theirs accept method
> or define some callback in PHP?

Not currently.  I'm mentoring a student in Google's Summer of Code to
add the needed support to SWIG to allow such subclassing, and given
his progress so far it seems very likely he'll succeed.  So this will
probably be possible in the development version of Xapian in a month or
two.

> Has someone solved this problem? Or how do you filter documents by
> permissions?

I'd index the permissions as terms and then filter on them by building a
boolean query from those terms.  Then you can use OP_FILTER to combine
that with the rest of your query,

For example, you could model the standard Unix permissions system by
indexing these terms for each document:

  * XUSERfoo for a file owned by user "foo" and user-readable.
  * XGROUPbar for a file with group "bar" and group-readable.
  * XWORLD for a world readable file.

And if I'm in groups users and bar I can read files which match this
query:

    XUSERolly OR XGROUPusers OR XGROUPbar OR XWORLD

Cheers,
    Olly



More information about the Xapian-discuss mailing list