schemas/base.py
branchstable
changeset 8124 acc23c284432
parent 7995 9a9f35ef418c
child 8158 2ee254e74382
equal deleted inserted replaced
8118:7b2c7f3d3703 8124:acc23c284432
   179     object = 'CWUser'
   179     object = 'CWUser'
   180     composite = 'object'
   180     composite = 'object'
   181     cardinality = '?*'
   181     cardinality = '?*'
   182 
   182 
   183 
   183 
   184 class CWPermission(EntityType):
       
   185     """entity type that may be used to construct some advanced security configuration
       
   186     """
       
   187     __permissions__ = PUB_SYSTEM_ENTITY_PERMS
       
   188 
       
   189     name = String(required=True, indexed=True, internationalizable=True, maxsize=100,
       
   190                   description=_('name or identifier of the permission'))
       
   191     label = String(required=True, internationalizable=True, maxsize=100,
       
   192                    description=_('distinct label to distinguate between other '
       
   193                                  'permission entity of the same name'))
       
   194     require_group = SubjectRelation('CWGroup',
       
   195                                     description=_('groups to which the permission is granted'))
       
   196 
       
   197 # explicitly add X require_permission CWPermission for each entity that should have
       
   198 # configurable security
       
   199 class require_permission(RelationType):
       
   200     """link a permission to the entity. This permission should be used in the
       
   201     security definition of the entity's type to be useful.
       
   202     """
       
   203     __permissions__ = PUB_SYSTEM_REL_PERMS
       
   204 
       
   205 class require_group(RelationType):
       
   206     """used to grant a permission to a group"""
       
   207     __permissions__ = PUB_SYSTEM_REL_PERMS
       
   208 
       
   209 
   184 
   210 class ExternalUri(EntityType):
   185 class ExternalUri(EntityType):
   211     """a URI representing an object in external data store"""
   186     """a URI representing an object in external data store"""
   212     uri = String(required=True, unique=True, maxsize=256,
   187     uri = String(required=True, unique=True, maxsize=256,
   213                  description=_('the URI of the object'))
   188                  description=_('the URI of the object'))
   328     subject = '*'
   303     subject = '*'
   329     object = 'CWSource'
   304     object = 'CWSource'
   330     cardinality = '1*'
   305     cardinality = '1*'
   331     composite = 'object'
   306     composite = 'object'
   332 
   307 
       
   308 
       
   309 class CWDataImport(EntityType):
       
   310     __permissions__ = ENTITY_MANAGERS_PERMISSIONS
       
   311     start_timestamp = TZDatetime()
       
   312     end_timestamp = TZDatetime()
       
   313     log = String()
       
   314     status = String(required=True, internationalizable=True, indexed=True,
       
   315                     default='in progress',
       
   316                     vocabulary=[_('in progress'), _('success'), _('failed')])
       
   317 
       
   318 class cw_import_of(RelationDefinition):
       
   319     __permissions__ = RELATION_MANAGERS_PERMISSIONS
       
   320     subject = 'CWDataImport'
       
   321     object = 'CWSource'
       
   322     cardinality = '1*'
       
   323     composite = 'object'
       
   324 
       
   325 
   333 class CWSourceSchemaConfig(EntityType):
   326 class CWSourceSchemaConfig(EntityType):
   334     __permissions__ = ENTITY_MANAGERS_PERMISSIONS
   327     __permissions__ = ENTITY_MANAGERS_PERMISSIONS
   335     cw_for_source = SubjectRelation(
   328     cw_for_source = SubjectRelation(
   336         'CWSource', inlined=True, cardinality='1*', composite='object',
   329         'CWSource', inlined=True, cardinality='1*', composite='object',
   337         __permissions__=RELATION_MANAGERS_PERMISSIONS)
   330         __permissions__=RELATION_MANAGERS_PERMISSIONS)
   380     __permissions__ = {
   373     __permissions__ = {
   381         'read':   ('managers', 'users', 'guests',),
   374         'read':   ('managers', 'users', 'guests',),
   382         'add':    ('managers', RRQLExpression('U has_update_permission S'),),
   375         'add':    ('managers', RRQLExpression('U has_update_permission S'),),
   383         'delete': ('managers', RRQLExpression('U has_update_permission S'),),
   376         'delete': ('managers', RRQLExpression('U has_update_permission S'),),
   384         }
   377         }
       
   378 
       
   379