def getActionsRoot(self, identifier, **options): ''' @see: IActionCategoryPrototype.getActionsRoot ''' sql = self.session().query(self.CategoryAction.actionPath).join(self.Category) sql = sql.filter(self.CategoryIdentifier == identifier) return processCollection(listRootPaths(path for path, in sql.all()), **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)