예제 #1
0
    def __init__(self, Mapped, QEntity=None, **mapping):
        '''
        Construct the entity support for the provided model class and query class.
        
        @param Mapped: class
            The mapped entity model class.
        @param QEntity: class|None
            The query mapped class if there is one.
        @param mapping: key arguments of columns
            The column mappings provided for criteria name in case they are needed, this is only used if a QEntity is
            provided.
        '''
        assert isclass(Mapped), 'Invalid class %s' % Mapped
        assert isinstance(Mapped, MappedSupport), 'Invalid mapped class %s' % Mapped
        model = typeFor(Mapped)
        assert isinstance(model, TypeModel), 'Invalid model class %s' % Mapped
        assert isinstance(model.propertyId, TypeProperty), 'Invalid model property id %s' % model.propertyId
        
        self.Entity = model.clazz
        self.Mapped = Mapped
        self.MappedId = modelId(Mapped)

        if QEntity is not None:
            assert isclass(QEntity), 'Invalid class %s' % QEntity
            assert isinstance(typeFor(QEntity), TypeQuery), 'Invalid query entity class %s' % QEntity
            if __debug__:
                for name in mapping:
                    assert name in typeFor(QEntity).properties, 'Invalid criteria name \'%s\' for %s' % (name, QEntity)
            self._mapping = mapping
        else: assert not mapping, 'Illegal mappings %s with no QEntity provided' % mapping
        self.QEntity = QEntity
예제 #2
0
 def __init__(self, Acl, AclAccess, Compensate, signatures=None):
     '''
     Construct the compensate service alchemy.
     
     @param AclAccess: class of WithAclAccess
         The ACL access relation mapped class.
     @param Compensate: class of WithCompensate
         The compensate relation mapped class.
     @param signatures: dictionary{string: string|callable(identifier) -> string}
         A dictionary containing as keys the signatures that will be injected and as a value either the marker to be injected
         or a callable that takes the identifier as a parameter and provides the marker string value.
     '''
     assert isinstance(Acl, MappedSupport), 'Invalid mapped class %s' % Acl
     assert issubclass(AclAccess, WithAclAccess), 'Invalid acl access class %s' % AclAccess
     assert issubclass(Compensate, WithCompensate), 'Invalid compensate class %s' % Compensate
     if __debug__:
         if signatures is not None:
             assert isinstance(signatures, dict), 'Invalid fill in signatures %s' % signatures
             for signature, marker in signatures.items():
                 assert isinstance(signature, str), 'Invalid signature %s' % signature
                 assert isinstance(marker, str) or callable(marker), 'Invalid marker %s' % marker
     
     self.Acl = Acl
     self.AclIdentifier = modelId(Acl)
     self.AclAccess = AclAccess
     self.AliasAclAccess = aliased(AclAccess)
     self.Compensate = Compensate
     
     self.signatures = signatures
예제 #3
0
파일: rbac.py 프로젝트: cristidomsa/Ally-Py
 def __init__(self, Rbac):
     '''
     Construct the RBAC service alchemy.
     
     @param Rbac: Base class
         The Rbac mapped class that organizes the RBAC structure.
     '''
     assert isinstance(Rbac, MappedSupport), 'Invalid mapped class %s' % Rbac
     assert issubclass(Rbac, WithRbac), 'Invalid Rbac class %s' % Rbac
     
     self.Rbac = Rbac
     self.RbacIdentifier = modelId(Rbac)
예제 #4
0
파일: rbac.py 프로젝트: cristidomsa/Ally-Py
    def __init__(self, Rbac):
        '''
        Construct the RBAC service alchemy.
        
        @param Rbac: Base class
            The Rbac mapped class that organizes the RBAC structure.
        '''
        assert isinstance(Rbac,
                          MappedSupport), 'Invalid mapped class %s' % Rbac
        assert issubclass(Rbac, WithRbac), 'Invalid Rbac class %s' % Rbac

        self.Rbac = Rbac
        self.RbacIdentifier = modelId(Rbac)
예제 #5
0
 def __init__(self, Category, CategoryAction):
     '''
     Construct the action category service alchemy.
     
     @param Category: Base class
         The category mapped class that organizes the actions based on.
     @param CategoryAction: class of WithCategoryAction
         The action category relation mapped class.
     '''
     assert isinstance(Category, MappedSupport), 'Invalid mapped class %s' % Category
     assert issubclass(CategoryAction, WithCategoryAction), 'Invalid category action class %s' % CategoryAction
     pks = [pk for pk in mappingFor(Category).columns if pk.primary_key]
     assert pks, 'Cannot detect any primary key for %s' % Category
     assert not len(pks) > 1, 'To many primary keys %s for %s' % (pks, Category)
     
     self.Category = Category
     self.CategoryId = pks[0]
     self.CategoryIdentifier = modelId(Category)
     self.CategoryAction = CategoryAction
예제 #6
0
파일: acl.py 프로젝트: cristidomsa/Ally-Py
 def __init__(self, Acl, AclAccess):
     '''
     Construct the ACL service alchemy.
     
     @param Acl: Base class
         The ACL mapped class that organizes the ACL structure.
     @param AclAccess: class of WithAclAccess
         The ACL access relation mapped class.
     '''
     assert isinstance(Acl, MappedSupport), 'Invalid mapped class %s' % Acl
     assert issubclass(AclAccess, WithAclAccess), 'Invalid acl access class %s' % AclAccess
     pks = [pk for pk in mappingFor(Acl).columns if pk.primary_key]
     assert pks, 'Cannot detect any primary key for %s' % Acl
     assert not len(pks) > 1, 'To many primary keys %s for %s' % (pks, Acl)
     
     self.Acl = Acl
     self.AclId = pks[0]
     self.AclIdentifier = modelId(Acl)
     self.AclAccess = AclAccess
     self.EntryFilter = AclAccess.EntryFilter
     self.PropertyFilter = AclAccess.PropertyFilter
예제 #7
0
    def __init__(self, Mapped, QEntity=None, **mapping):
        '''
        Construct the entity support for the provided model class and query class.
        
        @param Mapped: class
            The mapped entity model class.
        @param QEntity: class|None
            The query mapped class if there is one.
        @param mapping: key arguments of columns
            The column mappings provided for criteria name in case they are needed, this is only used if a QEntity is
            provided.
        '''
        assert isclass(Mapped), 'Invalid class %s' % Mapped
        assert isinstance(Mapped,
                          MappedSupport), 'Invalid mapped class %s' % Mapped
        model = typeFor(Mapped)
        assert isinstance(model, TypeModel), 'Invalid model class %s' % Mapped
        assert isinstance(
            model.propertyId,
            TypeProperty), 'Invalid model property id %s' % model.propertyId

        self.Entity = model.clazz
        self.Mapped = Mapped
        self.MappedId = modelId(Mapped)

        if QEntity is not None:
            assert isclass(QEntity), 'Invalid class %s' % QEntity
            assert isinstance(
                typeFor(QEntity),
                TypeQuery), 'Invalid query entity class %s' % QEntity
            if __debug__:
                for name in mapping:
                    assert name in typeFor(
                        QEntity
                    ).properties, 'Invalid criteria name \'%s\' for %s' % (
                        name, QEntity)
            self._mapping = mapping
        else:
            assert not mapping, 'Illegal mappings %s with no QEntity provided' % mapping
        self.QEntity = QEntity
예제 #8
0
    def __init__(self, Acl, AclAccess, Compensate, signatures=None):
        '''
        Construct the compensate service alchemy.
        
        @param AclAccess: class of WithAclAccess
            The ACL access relation mapped class.
        @param Compensate: class of WithCompensate
            The compensate relation mapped class.
        @param signatures: dictionary{string: string|callable(identifier) -> string}
            A dictionary containing as keys the signatures that will be injected and as a value either the marker to be injected
            or a callable that takes the identifier as a parameter and provides the marker string value.
        '''
        assert isinstance(Acl, MappedSupport), 'Invalid mapped class %s' % Acl
        assert issubclass(
            AclAccess,
            WithAclAccess), 'Invalid acl access class %s' % AclAccess
        assert issubclass(
            Compensate,
            WithCompensate), 'Invalid compensate class %s' % Compensate
        if __debug__:
            if signatures is not None:
                assert isinstance(
                    signatures,
                    dict), 'Invalid fill in signatures %s' % signatures
                for signature, marker in signatures.items():
                    assert isinstance(signature,
                                      str), 'Invalid signature %s' % signature
                    assert isinstance(
                        marker,
                        str) or callable(marker), 'Invalid marker %s' % marker

        self.Acl = Acl
        self.AclIdentifier = modelId(Acl)
        self.AclAccess = AclAccess
        self.AliasAclAccess = aliased(AclAccess)
        self.Compensate = Compensate

        self.signatures = signatures
예제 #9
0
    def __init__(self, Acl, AclAccess):
        '''
        Construct the ACL service alchemy.
        
        @param Acl: Base class
            The ACL mapped class that organizes the ACL structure.
        @param AclAccess: class of WithAclAccess
            The ACL access relation mapped class.
        '''
        assert isinstance(Acl, MappedSupport), 'Invalid mapped class %s' % Acl
        assert issubclass(
            AclAccess,
            WithAclAccess), 'Invalid acl access class %s' % AclAccess
        pks = [pk for pk in mappingFor(Acl).columns if pk.primary_key]
        assert pks, 'Cannot detect any primary key for %s' % Acl
        assert not len(pks) > 1, 'To many primary keys %s for %s' % (pks, Acl)

        self.Acl = Acl
        self.AclId = pks[0]
        self.AclIdentifier = modelId(Acl)
        self.AclAccess = AclAccess
        self.EntryFilter = AclAccess.EntryFilter
        self.PropertyFilter = AclAccess.PropertyFilter
예제 #10
0
파일: rbac.py 프로젝트: cristidomsa/Ally-Py
 def remRole(self, identifier:lambda p:modelId(p.RBAC), roleName:Role.Name) -> bool:
     '''
예제 #11
0
 def insert(self, entity):
     '''
     @see: IEntityCRUDPrototype.insert
     '''
     return modelId(insertModel(self.Mapped, entity))
예제 #12
0
파일: rbac.py 프로젝트: cristidomsa/Ally-Py
 def addRight(self, identifier:lambda p:modelId(p.RBAC), rightId:Right.Id):
     '''
예제 #13
0
 def insert(self, entity:lambda p:p.Entity) -> lambda p:modelId(p.Entity):
     '''
예제 #14
0
 def getAll(self, q:lambda p:p.QEntity=None, **options:SliceAndTotal) -> lambda p:Iter(modelId(p.Entity)):
     '''
예제 #15
0
파일: acl.py 프로젝트: cristidomsa/Ally-Py
 def getAcls(self, accessId:Access, **options:SliceAndTotal) -> lambda p: Iter(modelId(p.ACL)):
     '''
예제 #16
0
파일: acl.py 프로젝트: cristidomsa/Ally-Py
 def addPropertyFilter(self, identifier:lambda p: modelId(p.ACL), accessId:Access.Id,
                       propertyName:Property, filterName:Filter.Name):
     '''
예제 #17
0
파일: acl.py 프로젝트: cristidomsa/Ally-Py
 def addAcl(self, identifier:lambda p: modelId(p.ACL), accessId:Access.Id):
     '''
예제 #18
0
파일: acl.py 프로젝트: cristidomsa/Ally-Py
 def addAcl(self, identifier: lambda p: modelId(p.ACL),
            accessId: Access.Id):
     '''
예제 #19
0
파일: rbac.py 프로젝트: cristidomsa/Ally-Py
 def remRight(self, identifier:lambda p:modelId(p.RBAC), rightId:Right.Id) -> bool:
     '''
예제 #20
0
 def remCompensate(self, identifier:lambda p: modelId(p.ACL), accessId:Access.Id, compensatedId:Access.Id) -> bool:
     '''
예제 #21
0
 def addCompensate(self, identifier:lambda p: modelId(p.ACL), accessId:Access.Id, compensatedId:Access.Id):
     '''
예제 #22
0
파일: rbac.py 프로젝트: cristidomsa/Ally-Py
 def addRole(self, identifier:lambda p:modelId(p.RBAC), roleName:Role.Name):
     '''
예제 #23
0
파일: acl.py 프로젝트: cristidomsa/Ally-Py
 def addEntryFilter(self, identifier: lambda p: modelId(p.ACL),
                    accessId: Access.Id, entryPosition: Entry.Position,
                    filterName: Filter.Name):
     '''
예제 #24
0
 def insert(self, entity):
     '''
     @see: IEntityCRUDPrototype.insert
     '''
     return modelId(insertModel(self.Mapped, entity))
예제 #25
0
파일: acl.py 프로젝트: cristidomsa/Ally-Py
 def addEntryFilter(self, identifier:lambda p: modelId(p.ACL), accessId:Access.Id,
                    entryPosition:Entry.Position, filterName:Filter.Name):
     '''
예제 #26
0
파일: acl.py 프로젝트: cristidomsa/Ally-Py
 def addPropertyFilter(self, identifier: lambda p: modelId(p.ACL),
                       accessId: Access.Id, propertyName: Property,
                       filterName: Filter.Name):
     '''
예제 #27
0
파일: acl.py 프로젝트: cristidomsa/Ally-Py
 def registerFilter(self, identifier:lambda p: modelId(p.ACL), accessId:Access.Id,
                    filterName:Filter.Name, place:str=None) -> bool:
     '''
예제 #28
0
파일: acl.py 프로젝트: cristidomsa/Ally-Py
 def registerFilter(self,
                    identifier: lambda p: modelId(p.ACL),
                    accessId: Access.Id,
                    filterName: Filter.Name,
                    place: str = None) -> bool:
     '''
예제 #29
0
 def addAction(self, identifier:lambda p: modelId(p.CATEGORY), actionPath:Action.Path):
     '''
예제 #30
0
파일: acl.py 프로젝트: cristidomsa/Ally-Py
 def getAcls(self, accessId: Access,
             **options: SliceAndTotal) -> lambda p: Iter(modelId(p.ACL)):
     '''