def getActions(self, identifier, **options): ''' @see: IActionCategoryPrototype.getActions ''' sql = self.session().query(self.CategoryAction.actionPath).join(self.Category) sql = sql.filter(self.CategoryIdentifier == identifier) return processCollection(listCompletePaths(path for path, in sql.all()), **options)
def getProperties(self, **options): ''' @see: IModelService.getProperties ''' intr = self.processing.execute(Introspect=self.processing.ctx.introspect).introspect assert isinstance(intr, Introspect), 'Invalid introspect %s' % intr return processCollection(intr.properties.keys(), **options)
def getModels(self, q=None, **options): ''' @see: IIntrospectService.getModels ''' assert q is None or isinstance(q, QModel), 'Invalid query %s' % q intr = self.processing.execute(Introspect=self.processing.ctx.introspect).introspect assert isinstance(intr, Introspect), 'Invalid introspect %s' % intr return processCollection(intr.models.keys(), Model, q, lambda api: intr.models[api], **options)
def getActionsRoot(self, identifier, **options): ''' @see: IUserRbacService.getActions ''' rbacId = self.findRbacId(identifier) if rbacId is None: return emptyCollection(**options) sql = self.session().query(distinct(RightAction.actionPath)) sql = sql.filter(RightAction.categoryId.in_(self.sqlRights(rbacId))) # @UndefinedVariable return processCollection(listRootPaths(path for path, in sql.all()), **options)
def getSubActions(self, identifier, parentPath, **options): ''' @see: IActionCategoryPrototype.getSubActions ''' assert isinstance(parentPath, str), 'Invalid parent path %s' % parentPath sql = self.session().query(self.CategoryAction.actionPath).join(self.Category) sql = sql.filter(self.CategoryIdentifier == identifier) sql = sql.filter(self.CategoryAction.actionPath.like('%s.%%' % parentPath)) return processCollection(listRootPaths((path for path, in sql.all()), len(parentPath) + 1), **options)
def getSubActions(self, identifier, parentPath, **options): ''' @see: IUserRbacService.getSubActions ''' assert isinstance(parentPath, str), 'Invalid parent path %s' % parentPath rbacId = self.findRbacId(identifier) if rbacId is None: return emptyCollection(**options) sql = self.session().query(distinct(RightAction.actionPath)) sql = sql.filter(RightAction.categoryId.in_(self.sqlRights(rbacId))) # @UndefinedVariable sql = sql.filter(RightAction.actionPath.like('%s.%%' % parentPath)) # @UndefinedVariable return processCollection(listRootPaths((path for path, in sql.all()), len(parentPath) + 1), **options)
def getAll(self, q=None, **options): ''' Provides the components ids. @see: IComponentService.getAll ''' return processCollection(self.modules().keys(), self.Component, q, self.getById, **options)