author | Denis Laxalde <denis.laxalde@logilab.fr> |
Wed, 24 Jul 2019 16:52:00 +0200 | |
changeset 12711 | 9d72e299309e |
parent 12518 | cubicweb/test/data/cubicweb_localperms/schema.py@12e8b65146d9 |
permissions | -rw-r--r-- |
12518
12e8b65146d9
[test] drop dependency on third party cubes
Philippe Pepiot <philippe.pepiot@logilab.fr>
parents:
diff
changeset
|
1 |
from yams.buildobjs import EntityType, RelationType, RelationDefinition, String |
12e8b65146d9
[test] drop dependency on third party cubes
Philippe Pepiot <philippe.pepiot@logilab.fr>
parents:
diff
changeset
|
2 |
from cubicweb.schema import PUB_SYSTEM_ENTITY_PERMS, PUB_SYSTEM_REL_PERMS |
12e8b65146d9
[test] drop dependency on third party cubes
Philippe Pepiot <philippe.pepiot@logilab.fr>
parents:
diff
changeset
|
3 |
|
12e8b65146d9
[test] drop dependency on third party cubes
Philippe Pepiot <philippe.pepiot@logilab.fr>
parents:
diff
changeset
|
4 |
|
12e8b65146d9
[test] drop dependency on third party cubes
Philippe Pepiot <philippe.pepiot@logilab.fr>
parents:
diff
changeset
|
5 |
class CWPermission(EntityType): |
12e8b65146d9
[test] drop dependency on third party cubes
Philippe Pepiot <philippe.pepiot@logilab.fr>
parents:
diff
changeset
|
6 |
"""entity type that may be used to construct some advanced security |
12e8b65146d9
[test] drop dependency on third party cubes
Philippe Pepiot <philippe.pepiot@logilab.fr>
parents:
diff
changeset
|
7 |
configuration |
12e8b65146d9
[test] drop dependency on third party cubes
Philippe Pepiot <philippe.pepiot@logilab.fr>
parents:
diff
changeset
|
8 |
""" |
12e8b65146d9
[test] drop dependency on third party cubes
Philippe Pepiot <philippe.pepiot@logilab.fr>
parents:
diff
changeset
|
9 |
__permissions__ = PUB_SYSTEM_ENTITY_PERMS |
12e8b65146d9
[test] drop dependency on third party cubes
Philippe Pepiot <philippe.pepiot@logilab.fr>
parents:
diff
changeset
|
10 |
|
12e8b65146d9
[test] drop dependency on third party cubes
Philippe Pepiot <philippe.pepiot@logilab.fr>
parents:
diff
changeset
|
11 |
name = String(required=True, indexed=True, internationalizable=True, |
12e8b65146d9
[test] drop dependency on third party cubes
Philippe Pepiot <philippe.pepiot@logilab.fr>
parents:
diff
changeset
|
12 |
maxsize=100, description=( |
12e8b65146d9
[test] drop dependency on third party cubes
Philippe Pepiot <philippe.pepiot@logilab.fr>
parents:
diff
changeset
|
13 |
'name or identifier of the permission')) |
12e8b65146d9
[test] drop dependency on third party cubes
Philippe Pepiot <philippe.pepiot@logilab.fr>
parents:
diff
changeset
|
14 |
label = String(required=True, internationalizable=True, maxsize=100, |
12e8b65146d9
[test] drop dependency on third party cubes
Philippe Pepiot <philippe.pepiot@logilab.fr>
parents:
diff
changeset
|
15 |
description=('distinct label to distinguate between other ' |
12e8b65146d9
[test] drop dependency on third party cubes
Philippe Pepiot <philippe.pepiot@logilab.fr>
parents:
diff
changeset
|
16 |
'permission entity of the same name')) |
12e8b65146d9
[test] drop dependency on third party cubes
Philippe Pepiot <philippe.pepiot@logilab.fr>
parents:
diff
changeset
|
17 |
|
12e8b65146d9
[test] drop dependency on third party cubes
Philippe Pepiot <philippe.pepiot@logilab.fr>
parents:
diff
changeset
|
18 |
|
12e8b65146d9
[test] drop dependency on third party cubes
Philippe Pepiot <philippe.pepiot@logilab.fr>
parents:
diff
changeset
|
19 |
class granted_permission(RelationType): |
12e8b65146d9
[test] drop dependency on third party cubes
Philippe Pepiot <philippe.pepiot@logilab.fr>
parents:
diff
changeset
|
20 |
"""explicitly granted permission on an entity""" |
12e8b65146d9
[test] drop dependency on third party cubes
Philippe Pepiot <philippe.pepiot@logilab.fr>
parents:
diff
changeset
|
21 |
__permissions__ = PUB_SYSTEM_REL_PERMS |
12e8b65146d9
[test] drop dependency on third party cubes
Philippe Pepiot <philippe.pepiot@logilab.fr>
parents:
diff
changeset
|
22 |
# XXX cardinality = '*1' |
12e8b65146d9
[test] drop dependency on third party cubes
Philippe Pepiot <philippe.pepiot@logilab.fr>
parents:
diff
changeset
|
23 |
|
12e8b65146d9
[test] drop dependency on third party cubes
Philippe Pepiot <philippe.pepiot@logilab.fr>
parents:
diff
changeset
|
24 |
|
12e8b65146d9
[test] drop dependency on third party cubes
Philippe Pepiot <philippe.pepiot@logilab.fr>
parents:
diff
changeset
|
25 |
class require_permission(RelationType): |
12e8b65146d9
[test] drop dependency on third party cubes
Philippe Pepiot <philippe.pepiot@logilab.fr>
parents:
diff
changeset
|
26 |
__permissions__ = PUB_SYSTEM_REL_PERMS |
12e8b65146d9
[test] drop dependency on third party cubes
Philippe Pepiot <philippe.pepiot@logilab.fr>
parents:
diff
changeset
|
27 |
|
12e8b65146d9
[test] drop dependency on third party cubes
Philippe Pepiot <philippe.pepiot@logilab.fr>
parents:
diff
changeset
|
28 |
|
12e8b65146d9
[test] drop dependency on third party cubes
Philippe Pepiot <philippe.pepiot@logilab.fr>
parents:
diff
changeset
|
29 |
class require_group(RelationDefinition): |
12e8b65146d9
[test] drop dependency on third party cubes
Philippe Pepiot <philippe.pepiot@logilab.fr>
parents:
diff
changeset
|
30 |
"""groups to which the permission is granted""" |
12e8b65146d9
[test] drop dependency on third party cubes
Philippe Pepiot <philippe.pepiot@logilab.fr>
parents:
diff
changeset
|
31 |
__permissions__ = PUB_SYSTEM_REL_PERMS |
12e8b65146d9
[test] drop dependency on third party cubes
Philippe Pepiot <philippe.pepiot@logilab.fr>
parents:
diff
changeset
|
32 |
subject = 'CWPermission' |
12e8b65146d9
[test] drop dependency on third party cubes
Philippe Pepiot <philippe.pepiot@logilab.fr>
parents:
diff
changeset
|
33 |
object = 'CWGroup' |
12e8b65146d9
[test] drop dependency on third party cubes
Philippe Pepiot <philippe.pepiot@logilab.fr>
parents:
diff
changeset
|
34 |
|
12e8b65146d9
[test] drop dependency on third party cubes
Philippe Pepiot <philippe.pepiot@logilab.fr>
parents:
diff
changeset
|
35 |
|
12e8b65146d9
[test] drop dependency on third party cubes
Philippe Pepiot <philippe.pepiot@logilab.fr>
parents:
diff
changeset
|
36 |
class has_group_permission(RelationDefinition): |
12e8b65146d9
[test] drop dependency on third party cubes
Philippe Pepiot <philippe.pepiot@logilab.fr>
parents:
diff
changeset
|
37 |
"""short cut relation for 'U in_group G, P require_group G' for efficiency |
12e8b65146d9
[test] drop dependency on third party cubes
Philippe Pepiot <philippe.pepiot@logilab.fr>
parents:
diff
changeset
|
38 |
reason. This relation is set automatically, you should not set this. |
12e8b65146d9
[test] drop dependency on third party cubes
Philippe Pepiot <philippe.pepiot@logilab.fr>
parents:
diff
changeset
|
39 |
""" |
12e8b65146d9
[test] drop dependency on third party cubes
Philippe Pepiot <philippe.pepiot@logilab.fr>
parents:
diff
changeset
|
40 |
__permissions__ = PUB_SYSTEM_REL_PERMS |
12e8b65146d9
[test] drop dependency on third party cubes
Philippe Pepiot <philippe.pepiot@logilab.fr>
parents:
diff
changeset
|
41 |
subject = 'CWUser' |
12e8b65146d9
[test] drop dependency on third party cubes
Philippe Pepiot <philippe.pepiot@logilab.fr>
parents:
diff
changeset
|
42 |
object = 'CWPermission' |