def getProperties(self, accessId): ''' @see: IAccessService.getProperties ''' assert isinstance(accessId, int), 'Invalid access id %s' % accessId return iterateCollection(self.session().query( PropertyMapped.Name).filter(PropertyMapped.accessId == accessId))
def getActionsRoot(self, **options): ''' @see: IActionManagerService.getActionsRoot ''' sql = self.session().query(ActionMapped.Path).filter( not_(ActionMapped.Path.like('%.%'))) return iterateCollection(sql, **options)
def getEntries(self, accessId): ''' @see: IAccessService.getEntries ''' assert isinstance(accessId, int), 'Invalid access id %s' % accessId return iterateCollection(self.session().query( EntryMapped.Position).filter(EntryMapped.accessId == accessId))
def getSubActions(self, path, **options): ''' @see: IActionManagerService.getSubActions ''' assert isinstance(path, str), 'Invalid path %s' % path sql = self.session().query(ActionMapped.Path).filter(ActionMapped.Path.like('%s.%%' % path)) return iterateCollection(sql, **options)
def getAll(self, **options): ''' @see: IEntityFindPrototype.getAll ''' return iterateCollection( self.session().query(self.MappedId).order_by(self.MappedId), **options)
def getSubActions(self, path, **options): ''' @see: IActionManagerService.getSubActions ''' assert isinstance(path, str), 'Invalid path %s' % path sql = self.session().query(ActionMapped.Path).filter( ActionMapped.Path.like('%s.%%' % path)) return iterateCollection(sql, **options)
def getAccesses(self, identifier, **options): ''' @see: IACLPrototype.getAccesses ''' sql = self.session().query(self.AclAccess.accessId).join(self.Acl) sql = sql.filter(self.AclIdentifier == identifier) sql = sql.order_by(self.AclAccess.accessId) return iterateCollection(sql, **options)
def getAccesses(self, identifier, **options): ''' @see: IACLPrototype.getAccesses ''' sql = self.session().query(self.AclAccess.accessId).join(self.Acl) sql = sql.filter(self.AclIdentifier == identifier) sql = sql.order_by(self.AclAccess.accessId) return iterateCollection(sql, **options)
def getAcls(self, accessId, **options): ''' @see: IACLPrototype.getAcls ''' assert isinstance(accessId, int), 'Invalid access id %s' % accessId sql = self.session().query(self.AclIdentifier).join(self.AclAccess) sql = sql.filter(self.AclAccess.accessId == accessId) sql = sql.order_by(self.AclIdentifier) return iterateCollection(sql, **options)
def getAll(self, q=None, **options): ''' @see: IEntityQueryPrototype.getAll ''' assert self.QEntity is not None, 'No query available for this service' sql = self.session().query(self.MappedId) if q is not None: assert isinstance(q, self.QEntity), 'Invalid query %s' % q sql = buildQuery(sql, q, self.Mapped, orderBy=self.MappedId, autoJoin=True, **self._mapping) return iterateCollection(sql, **options)
def getAcls(self, accessId, **options): ''' @see: IACLPrototype.getAcls ''' assert isinstance(accessId, int), 'Invalid access id %s' % accessId sql = self.session().query(self.AclIdentifier).join(self.AclAccess) sql = sql.filter(self.AclAccess.accessId == accessId) sql = sql.order_by(self.AclIdentifier) return iterateCollection(sql, **options)
def getAll(self, typeName=None, q=None, **options): ''' @see: IRightService.getAll ''' sql = self.session().query(RightMapped.Id) if typeName: sql = sql.join(RightTypeMapped).filter(RightTypeMapped.Name == typeName) if q is not None: assert isinstance(q, QRight), 'Invalid query %s' % q sql = buildQuery(sql, q, RightMapped) return iterateCollection(sql, **options)
def getEntriesFiltered(self, identifier, accessId, **options): ''' @see: IACLPrototype.getEntriesFiltered ''' assert isinstance(accessId, int), 'Invalid access id %s' % accessId sql = self.session().query(distinct(EntryMapped.Position)) sql = sql.join(self.EntryFilter).join(self.AclAccess).join(self.Acl) sql = sql.filter(self.AclAccess.accessId == accessId).filter(self.AclIdentifier == identifier) sql = sql.order_by(EntryMapped.Position) return iterateCollection(sql, **options)
def getRights(self, identifier, typeName=None, q=None, **options): ''' @see: IRbacPrototype.getRights ''' rbacId = self.findRbacId(identifier) if rbacId is None: return emptyCollection(**options) sql = self.sqlRights(rbacId, typeName) if q: assert isinstance(q, QRight), 'Invalid query %s' % q sql = buildQuery(sql, q, RightMapped) return iterateCollection(sql, **options)
def getPropertyFilters(self, identifier, accessId, propertyName, **options): ''' @see: IACLPrototype.getPropertyFilters ''' assert isinstance(accessId, int), 'Invalid access id %s' % accessId assert isinstance(propertyName, str), 'Invalid property name %s' % propertyName sql = self.session().query(FilterMapped.Name) sql = sql.join(self.PropertyFilter).join(self.AclAccess).join(self.Acl).join(PropertyMapped) sql = sql.filter(self.AclAccess.accessId == accessId).filter(self.AclIdentifier == identifier) sql = sql.filter(PropertyMapped.Name == propertyName) return iterateCollection(sql, **options)
def getAll(self, typeName=None, q=None, **options): ''' @see: IRightService.getAll ''' sql = self.session().query(RightMapped.Id) if typeName: sql = sql.join(RightTypeMapped).filter( RightTypeMapped.Name == typeName) if q is not None: assert isinstance(q, QRight), 'Invalid query %s' % q sql = buildQuery(sql, q, RightMapped) return iterateCollection(sql, **options)
def getEntriesFiltered(self, identifier, accessId, **options): ''' @see: IACLPrototype.getEntriesFiltered ''' assert isinstance(accessId, int), 'Invalid access id %s' % accessId sql = self.session().query(distinct(EntryMapped.Position)) sql = sql.join(self.EntryFilter).join(self.AclAccess).join(self.Acl) sql = sql.filter(self.AclAccess.accessId == accessId).filter( self.AclIdentifier == identifier) sql = sql.order_by(EntryMapped.Position) return iterateCollection(sql, **options)
def getRights(self, identifier, typeName=None, q=None, **options): ''' @see: IRbacPrototype.getRights ''' rbacId = self.findRbacId(identifier) if rbacId is None: return emptyCollection(**options) sql = self.sqlRights(rbacId, typeName) if q: assert isinstance(q, QRight), 'Invalid query %s' % q sql = buildQuery(sql, q, RightMapped) return iterateCollection(sql, **options)
def getEntryFilters(self, identifier, accessId, entryPosition, **options): ''' @see: IACLPrototype.getEntryFilters ''' assert isinstance(accessId, int), 'Invalid access id %s' % accessId assert isinstance(entryPosition, int), 'Invalid entry position %s' % entryPosition sql = self.session().query(FilterMapped.Name) sql = sql.join(self.EntryFilter).join(self.AclAccess).join(self.Acl).join(EntryMapped) sql = sql.filter(self.AclAccess.accessId == accessId).filter(self.AclIdentifier == identifier) sql = sql.filter(EntryMapped.Position == entryPosition) sql = sql.order_by(FilterMapped.Name) return iterateCollection(sql, **options)
def getAll(self, q=None, **options): ''' @see: IEntityQueryPrototype.getAll ''' assert self.QEntity is not None, 'No query available for this service' sql = self.session().query(self.MappedId) if q is not None: assert isinstance(q, self.QEntity), 'Invalid query %s' % q sql = buildQuery(sql, q, self.Mapped, orderBy=self.MappedId, autoJoin=True, **self._mapping) return iterateCollection(sql, **options)
def getEntryFilters(self, identifier, accessId, entryPosition, **options): ''' @see: IACLPrototype.getEntryFilters ''' assert isinstance(accessId, int), 'Invalid access id %s' % accessId assert isinstance(entryPosition, int), 'Invalid entry position %s' % entryPosition sql = self.session().query(FilterMapped.Name) sql = sql.join(self.EntryFilter).join(self.AclAccess).join( self.Acl).join(EntryMapped) sql = sql.filter(self.AclAccess.accessId == accessId).filter( self.AclIdentifier == identifier) sql = sql.filter(EntryMapped.Position == entryPosition) sql = sql.order_by(FilterMapped.Name) return iterateCollection(sql, **options)
def getRoles(self, identifier, q=None, **options): ''' @see: IRbacPrototype.getRoles ''' rbacId = self.findRbacId(identifier) if rbacId is None: return emptyCollection(**options) sql = self.session().query(RoleMapped.Name) sql = sql.join(Child, Child.roleId == RoleMapped.id) sql = sql.join(Parent, and_(Child.left >= Parent.left, Child.right <= Parent.right)) sql = sql.join(RbacRole, and_(RbacRole.roleId == Parent.roleId, RbacRole.rbacId == rbacId)) sql = sql.order_by(RoleMapped.Name) if q: assert isinstance(q, QRole), 'Invalid query %s' % q sql = buildQuery(sql, q, RoleMapped) return iterateCollection(sql, **options)
def getPropertyFilters(self, identifier, accessId, propertyName, **options): ''' @see: IACLPrototype.getPropertyFilters ''' assert isinstance(accessId, int), 'Invalid access id %s' % accessId assert isinstance(propertyName, str), 'Invalid property name %s' % propertyName sql = self.session().query(FilterMapped.Name) sql = sql.join(self.PropertyFilter).join(self.AclAccess).join( self.Acl).join(PropertyMapped) sql = sql.filter(self.AclAccess.accessId == accessId).filter( self.AclIdentifier == identifier) sql = sql.filter(PropertyMapped.Name == propertyName) return iterateCollection(sql, **options)
def getRoles(self, identifier, q=None, **options): ''' @see: IRbacPrototype.getRoles ''' rbacId = self.findRbacId(identifier) if rbacId is None: return emptyCollection(**options) sql = self.session().query(RoleMapped.Name) sql = sql.join(Child, Child.roleId == RoleMapped.id) sql = sql.join( Parent, and_(Child.left >= Parent.left, Child.right <= Parent.right)) sql = sql.join( RbacRole, and_(RbacRole.roleId == Parent.roleId, RbacRole.rbacId == rbacId)) sql = sql.order_by(RoleMapped.Name) if q: assert isinstance(q, QRole), 'Invalid query %s' % q sql = buildQuery(sql, q, RoleMapped) return iterateCollection(sql, **options)
def getProperties(self, accessId): ''' @see: IAccessService.getProperties ''' assert isinstance(accessId, int), 'Invalid access id %s' % accessId return iterateCollection(self.session().query(PropertyMapped.Name).filter(PropertyMapped.accessId == accessId))
def getAll(self, **options): ''' @see: IEntityFindPrototype.getAll ''' return iterateCollection(self.session().query(self.MappedId).order_by(self.MappedId), **options)
def getAll(self, **options): ''' @see: IGatewayService.getAll ''' return iterateCollection(self.session().query(GatewayData.name), **options)
def getActionsRoot(self, **options): ''' @see: IActionManagerService.getActionsRoot ''' sql = self.session().query(ActionMapped.Path).filter(not_(ActionMapped.Path.like('%.%'))) return iterateCollection(sql, **options)
def getAll(self, **options): ''' @see: IGatewayService.getAll ''' return iterateCollection(self.session().query(GatewayData.name), **options)
def getEntries(self, accessId): ''' @see: IAccessService.getEntries ''' assert isinstance(accessId, int), 'Invalid access id %s' % accessId return iterateCollection(self.session().query(EntryMapped.Position).filter(EntryMapped.accessId == accessId))