[Cubicweb] How to customize permissions on relations ?

Yann Cointepas yann at cointepas.net
Tue Jan 7 14:54:37 CET 2014


I am trying to define permissions for all entities and relations used in a
cube. At the end of schema.py of my cube I import all the
entities/relations I use and call set_permissions on them. It works for
entities but on relations, Cubicweb complains :

yams._exceptions.BadSchemaDefinition: conflicting values {'read':
('managers', 'users'), 'add': ('managers', RRQLExpression(Any S,U WHERE S
belong_to ST, U can_modify ST, S eid %(s)s, U eid %(u)s)), 'delete':
('managers', RRQLExpression(Any S,U WHERE S belong_to ST, U can_modify ST,
S eid %(s)s, U eid %(u)s))}/{'read': ('managers', 'users', 'guests'),
'add': ('managers', 'users'), 'delete': ('managers', RRQLExpression(Any S,U
WHERE S owned_by U, S eid %(s)s, U eid %(u)s))} for property
__permissions__ of relation 'comments'


The "comments" relation have the following definition (in
cubicweb-brainomics) :

class comments(RelationDefinition):
    subject = 'Comment'
    object = COMMENTED_ENTITIES


I am trying to set the following permissions:

RELATION_PERMISSIONS = {
  'read':   ( 'managers', 'users' ),
  'add':    ( 'managers', RRQLExpression( 'S belong_to ST, U can_modify ST'
) ),
  'delete': ( 'managers', RRQLExpression( 'S belong_to ST, U can_modify ST'
) )
}


Any help is welcome,

      Yann
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cubicweb.org/pipermail/cubicweb/attachments/20140107/5242be26/attachment-0164.html>


More information about the Cubicweb mailing list