[Cubicweb] ERQLExpression for update and delete permissions

Carlos Balderas carlos.balderas at gmail.com
Tue Sep 28 14:56:18 CEST 2010


Hi Syt !, sure...

* The cube uses a user named "userx" with the same password.

* Everything you need is created in precreate and postcreate files.
- Oh, question about this, Why precreate.py is not created automatically
when you create the cube, Is this file going to be replaced in other place
of the cube creation?. Of course I won't mind creating it when I need it,
but I was wondering if this kind of input process will be migrated in some
other part of the cubicweb code.

* Just create your cw instance and login with u:userx, p:userx , and you can
just query EntityOne, after that, you can uncomment the lines of
ERQLExpression in schema, recreate the database and see what happends with
the execution time.

Please let me know if you need more specific tests, so I can write them and
send them to you.

Thank you very much
Carlos Balderas


On Tue, Sep 28, 2010 at 12:46 AM, Sylvain Thénault <
sylvain.thenault at logilab.fr> wrote:

> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cubicweb.org/pipermail/cubicweb/attachments/20100928/604a8750/attachment-0165.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: testcase.tar.gz
Type: application/x-gzip
Size: 6529 bytes
Desc: not available
URL: <http://lists.cubicweb.org/pipermail/cubicweb/attachments/20100928/604a8750/attachment-0252.bin>


More information about the Cubicweb mailing list