[Cubicweb] RRQLExpression and ERQLExpression

mr.li.jinpeng at gmail.com mr.li.jinpeng at gmail.com
Tue Apr 15 16:02:04 CEST 2014


Hi Sylvain,

Thanks for your reply.

On 04/15/2014 03:23 PM, Sylvain Thénault wrote:
> On 15 avril 14:26, Jinpeng Li wrote:
>> Hi all,
> Hi,
>   
> your case #1 should be the right way to do this.
>
>> 1: Study.name doesn't inherit permissions from Study
> there is the problem. Which cubicweb/yams version are you using?
> What's the result of `schema['Study'].rdef('name').permissions`?
This is from case #1:

# cubicweb-ctl shell test_permission

 >>> import cubicweb
 >>> print cubicweb.__version__
3.18.4
 >>> import yams
 >>> print(yams.__version__)
0.39.1
 >>> print(schema['Study'].rdef('name').permissions)
{'read': (u'managers', u'users', u'guests'), 'add': (u'managers', 
ERQLExpression(Any X WHERE U has_add_permission X, X eid %(x)s, U eid 
%(u)s)), 'update': (u'managers', ERQLExpression(Any X WHERE U 
has_update_permission X, X eid %(x)s, U eid %(u)s))}

 >>> print(schema['Study'].permissions)
{'read': (u'managers', ERQLExpression(Any X WHERE U in_group G, G 
can_read X, X eid %(x)s, U eid %(u)s)), 'add': (u'managers', 
ERQLExpression(Any X WHERE U in_group G, G can_modify X, X eid %(x)s, U 
eid %(u)s)), 'update': (u'managers', ERQLExpression(Any X WHERE U 
in_group G, G can_modify X, X eid %(x)s, U eid %(u)s)), 'delete': 
(u'managers', ERQLExpression(Any X WHERE U in_group G, G can_modify X, X 
eid %(x)s, U eid %(u)s))}

>
>> 2: Study.get_relation("name").__permissions__ cannot use neither
>> RRQLExpression nor ERQLExpression.
> to precise things a bit:
>
> * attribute permissions should use ERQLExpression, RRQLExpression is for (non
>    final) relations only
>
> * you can't use rql expression in 'read' permissions for both attributes and
>    relations
Therefore how could I visit these attributes under those permission 
control? I think that it is linked to the first question.
Thanks for your answer,
Jinpeng



More information about the Cubicweb mailing list