当前位置: 首页>>代码示例>>Python>>正文


Python Authentication.get_roles_list方法代码示例

本文整理汇总了Python中authentication.Authentication.get_roles_list方法的典型用法代码示例。如果您正苦于以下问题:Python Authentication.get_roles_list方法的具体用法?Python Authentication.get_roles_list怎么用?Python Authentication.get_roles_list使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在authentication.Authentication的用法示例。


在下文中一共展示了Authentication.get_roles_list方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from authentication import Authentication [as 别名]
# 或者: from authentication.Authentication import get_roles_list [as 别名]
class SearchTreeData:
    def __init__(self):
        self.authentication = Authentication()
        self.authentication.session_init()
        self.__search()
    
    def __search(self):
        query = formData.get("query")
        searchQuery = sessionState.get("searchQuery")
        if query is None or query == "":
            query = "*:*"
        if searchQuery and query == "*:*":
            query = searchQuery
        elif searchQuery:
            query += " AND " + searchQuery
        facetField = formData.get("facet.field")
        
        req = SearchRequest(query)
        req.setParam("facet", "true")
        req.setParam("fl", "id")
        req.setParam("rows", "0")
        req.setParam("facet.limit", "-1")
        req.setParam("facet.field", facetField)
        
        fq = sessionState.get("fq")
        if fq is not None:
            req.setParam("fq", fq)
        req.addParam("fq", 'item_type:"object"')
        
        # Make sure 'fq' has already been set in the session
        security_roles = self.authentication.get_roles_list();
        security_query = 'security_filter:("' + '" OR "'.join(security_roles) + '")'
        req.addParam("fq", security_query)

        out = ByteArrayOutputStream()
        indexer = Services.getIndexer()
        indexer.search(req, out)
        result = JsonConfigHelper(ByteArrayInputStream(out.toByteArray()))
        
        self.__facetList = FacetList(facetField, result)
    
    def getFacetList(self):
        return self.__facetList
    
    def getFacet(self, value):
        return self.__facetList.get(value)
开发者ID:kiranba,项目名称:the-fascinator,代码行数:48,代码来源:search-tree.py


注:本文中的authentication.Authentication.get_roles_list方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。