[Cubicweb] ERQLExpression for update and delete permissions

Carlos Balderas carlos.balderas at gmail.com
Tue Sep 28 07:20:18 CEST 2010


Hello List,

About using ERQLExpression to define Entity's permissions, I noticed that
when I am using ERQLExpression for "update" or "delete" keys in
__permissions__ dictionary, the execution time for a simple rql e.g. (Any X
WHERE X is EntityOne) increases considerable than when only using the same
expression for "read" and/or "add" keys.

For instance, I made a little cube to test this behavior:

With 2,000 elements in EntityOne entity the rql: Any X WHERE X is EntityOne,
takes about 0.21 sec average, this is using an schema like this:

class EntityOne(EntityType):

    """"Entity to test ERQLExpression performance """

    __permissions__ = {
        'read'  : ('managers'
                   , ERQLExpression('X someoption "default", U in_group G'
                                   ', G name "groupx"')),
        'add'   : ('managers'
                   , ERQLExpression('X someoption "default", U in_group G'
                                    ', G name "groupx"')
                   ,),
        'update': ('managers'
                   # uncomment these lines to make the test slow
                   #, ERQLExpression('X someoption "default", U in_group G'
                   #                 ', G name "groupx"')
                  , ),
        'delete': ('managers'
                   # uncomment these lines to make the test slow
                   #, ERQLExpression('X someoption "default", U in_group G'
                   #                 ', G name "groupx"')
                  , ),

        }

    name = String(maxsize=16, description=_('simple name'))
    someoption = String(maxsize=16, description=_('someoption')
                        , default=u'default')

** notice that the ERQLExpression is exactly the same for read, add, update
and delete.

Then, when I use the ERQLExpression for "update" or "delete" (or both),  the
execution time for the same rql query goes up to 5.50 sec.

I was wondering if this is a normal behavior due a permissions management of
cubicweb ? or maybe I am doing something wrong.

Thank you for your support
Regards
Carlos Balderas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cubicweb.org/pipermail/cubicweb/attachments/20100928/91abb662/attachment-0126.html>


More information about the Cubicweb mailing list