cubicweb/test/data/cubicweb_localperms/schema.py
author Philippe Pepiot <philippe.pepiot@logilab.fr>
Fri, 15 Mar 2019 18:07:18 +0100
changeset 12518 12e8b65146d9
permissions -rw-r--r--
[test] drop dependency on third party cubes Drop dependency on cubicweb-file, cubicweb-localperms, cubicweb-tag and cubicweb-comment for cubicweb.test and cubicweb.sobjects.test Move cubicweb/test/data/libpython/cubicweb_* to cubicweb/test/data, so it's included in PYTHONPATH. Add missing parts of schema, entities, views, hooks that make tests pass.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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'