doc/book/en/development/datamodel/definition.rst
branchstable
changeset 3283 4f53eb3f1331
parent 3144 a5deac822a13
child 3581 669854258b90
equal deleted inserted replaced
3258:6536ee4f37f7 3283:4f53eb3f1331
    87     * `?`: 0..1
    87     * `?`: 0..1
    88     * `+`: 1..n
    88     * `+`: 1..n
    89     * `*`: 0..n
    89     * `*`: 0..n
    90 
    90 
    91   - `meta` : boolean indicating that the relation is a meta-relation (false by
    91   - `meta` : boolean indicating that the relation is a meta-relation (false by
    92     default)
    92     default, will disappear in *CubicWeb* 3.5)
    93 
    93 
    94 * optional properties for attributes :
    94 * optional properties for attributes :
    95 
    95 
    96   - `required` : boolean indicating if the attribute is required (false by default)
    96   - `required` : boolean indicating if the attribute is required (false by default)
    97 
    97 
   214 
   214 
   215 It is also possible to use specific groups if they are defined in the precreate
   215 It is also possible to use specific groups if they are defined in the precreate
   216 of the cube (``migration/precreate.py``).
   216 of the cube (``migration/precreate.py``).
   217 
   217 
   218 
   218 
   219 Use of RQL expression for writing rights
   219 Use of RQL expression for write permissions
   220 `````````````````````````````````````````
   220 ```````````````````````````````````````````
   221 It is possible to define RQL expression to provide update permission
   221 It is possible to define RQL expression to provide update permission
   222 (`add`, `delete` and `update`) on relation and entity types.
   222 (`add`, `delete` and `update`) on relation and entity types.
   223 
   223 
   224 RQL expression for entity type permission :
   224 RQL expression for entity type permission :
   225 
   225 
   247   which the action is being verified) and the user who executed the query
   247   which the action is being verified) and the user who executed the query
   248 
   248 
   249 * we can also defined rights on attributes of an entity (non-final relation),
   249 * we can also defined rights on attributes of an entity (non-final relation),
   250   knowing that :
   250   knowing that :
   251 
   251 
   252   - to defines RQL expression, we have to use the class `RQLExpression`
   252   - to define RQL expression, we have to use the class `RQLExpression`
   253     in which X represents the entity the attribute belongs to
   253     in which X represents the entity the attribute belongs to
   254 
   254 
   255   - the permissions `add` and `delete` are equivalent. Only `add`/`read`
   255   - the permissions `add` and `delete` are equivalent. Only `add`/`read`
   256     are actually taken in consideration.
   256     are actually taken in consideration.
   257 
   257 
   319 An attribute is defined in the schema as follows::
   319 An attribute is defined in the schema as follows::
   320 
   320 
   321     attr_name = attr_type(properties*)
   321     attr_name = attr_type(properties*)
   322 
   322 
   323 where `attr_type` is one of the type listed above and `properties` is
   323 where `attr_type` is one of the type listed above and `properties` is
   324 a list of  the attribute needs to statisfy (see :ref:`properties`
   324 a list of the attribute needs to statisfy (see :ref:`properties`
   325 for more details).
   325 for more details).
   326 
   326 
   327 
   327 
   328 * relations can be defined by using `ObjectRelation` or `SubjectRelation`.
   328 * relations can be defined by using `ObjectRelation` or `SubjectRelation`.
   329   The first argument of `SubjectRelation` or `ObjectRelation` gives respectively
   329   The first argument of `SubjectRelation` or `ObjectRelation` gives respectively
   432 new versions on this project to specific groups. It is important to notice that :
   432 new versions on this project to specific groups. It is important to notice that :
   433 
   433 
   434 * in such case, we have to protect both the entity type "Version" and the relation
   434 * in such case, we have to protect both the entity type "Version" and the relation
   435   associating a version to a project ("version_of")
   435   associating a version to a project ("version_of")
   436 
   436 
   437 * because of the genricity of the entity type `CWPermission`, we have to execute
   437 * because of the genericity of the entity type `CWPermission`, we have to execute
   438   a unification with the groups and/or the states if necessary in the expression
   438   a unification with the groups and/or the states if necessary in the expression
   439   ("U in_group G, P require_group G" in the above example)
   439   ("U in_group G, P require_group G" in the above example)