[Cubicweb] ERQLExpression for update and delete permissions

Sylvain Thénault sylvain.thenault at logilab.fr
Tue Sep 28 07:46:07 CEST 2010


On 28 septembre 00:20, Carlos Balderas wrote:
> Hello List,

Hi Carlos,
 
> 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.
 
Such a difference is weird anyway. Would you send me the whole test so I can
run it and take a look?
-- 
Sylvain Thénault                               LOGILAB, Paris (France)
Formations Python, Debian, Méth. Agiles: http://www.logilab.fr/formations
Développement logiciel sur mesure:       http://www.logilab.fr/services
CubicWeb, the semantic web framework:    http://www.cubicweb.org




More information about the Cubicweb mailing list