本文整理汇总了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)