Beispiel #1
0
 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)
Beispiel #2
0
    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)
Beispiel #3
0
 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)
Beispiel #4
0
 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)