[daisy] Dereference operator for query language
Scott Warren
scottwarren at ocom.com.au
Sun Jan 28 16:50:20 CST 2007
Hello,
I have written a UserHasRole predicate for Daisy 1.5 as we had discussed
before. This is useful for ACL where a Document has a Field that matches up
with the Roles that a user may have. Example
User A -> Role1, Role2, Role3
User B -> RoleA, RoleB, *Role3
Document A -> $RoleField = Role5, RoleT, RoleG
Document B -> $RoleField = *Role3, RoleT, RoleG
With the above configuration UserHasRole($RoleField) would be true for User
B but not User A because User B has the role Role3 and the field has the
value Role3
I made it like the InCollection predicate and allow multiple fields eg
UserHasRole($Field1, $Field2, $Field3)
I know this is for 1.5 is this useful and if so how can I get you a patch?
Regards
Scott Warren
> -----Original Message-----
> From: daisy-bounces at lists.cocoondev.org [mailto:daisy-
> bounces at lists.cocoondev.org] On Behalf Of Bruno Dumon
> Sent: Saturday, 27 January 2007 3:11 AM
> To: Daisy: open source CMS - general mailinglist
> Subject: [daisy] Dereference operator for query language
>
> Hi,
>
> I've been working on a new construct for the query language called the
> "dereference operator". It allows queries to traverse link fields in
> order to test on the values in the linked-to documents.
>
> For example:
>
> select $LinkField=>name where $LinkField=>name like 'foo%'
>
> The "=>" is used as notation for the link dereference operator (it is
> not "->" because dash is a valid character in identifiers in Daisy).
>
> So this query will return all documents that have a link field
> "$LinkField" which points to documents of which the name start with
> "foo". Doing a query like this was previously impossible.
>
> The link dereferencing can work as many levels of links deep as you
> like, so it's possible to do things like:
>
> ... where $LinkField=>$OtherLinkField=>$YetAnotherLinkField like 'foo%'
>
> It can basically be used everywhere where you can put a "value
> expression", thus also in the order by clause, as argument to functions,
> etc. It also works in the stand-alone expressions as used in the ACL or
> the publisher.
>
> Access control is also taken care of: if you try to dereference a link
> in the where clause, but you have no access to the document in the link,
> then the corresponding row will be removed from the result set (this is
> a special filtering performed by Daisy after executing the query on the
> SQL engine). In the select or order-by parts, a non-traversable link
> will simply give a "null" value.
>
> I've developed this functionality on a separate branch (BRANCH_DEREF),
> which I'll merge into trunk soon.
>
> Thoughts, remarks, questions welcome.
>
> --
> Bruno Dumon http://outerthought.org/
> Outerthought - Open Source, Java & XML Competence Support Center
> bruno at outerthought.org bruno at apache.org
>
> _______________________________________________
> daisy community mailing list
> Professional Daisy support:
> http://outerthought.org/site/services/daisy/daisysupport.html
> mail to: daisy at lists.cocoondev.org
> list information: http://lists.cocoondev.org/mailman/listinfo/daisy
More information about the daisy
mailing list