本文整理汇总了Python中authentication.Authentication.session_init方法的典型用法代码示例。如果您正苦于以下问题:Python Authentication.session_init方法的具体用法?Python Authentication.session_init怎么用?Python Authentication.session_init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类authentication.Authentication
的用法示例。
在下文中一共展示了Authentication.session_init方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from authentication import Authentication [as 别名]
# 或者: from authentication.Authentication import session_init [as 别名]
class LayoutData:
def __init__(self):
self.authentication = Authentication();
self.authentication.session_init();
def getPortal(self):
return Services.getPortalManager().get(portalId)
def getPortals(self):
return Services.getPortalManager().portals
def getPortalName(self):
return self.getPortal().getDescription()
def escapeText(self, text):
return StringEscapeUtils.escapeXml(text)
def md5Hash(self, data):
return md5.new(data).hexdigest()
def capitalise(self, text):
return text[0].upper() + text[1:]
def getTemplate(self, templateName):
portalName = portalId
if not Services.pageService.resourceExists(portalId, templateName, False):
portalName = Services.portalManager.DEFAULT_PORTAL_NAME
return "%s/%s" % (portalName, templateName)
示例2: __init__
# 需要导入模块: from authentication import Authentication [as 别名]
# 或者: from authentication.Authentication import session_init [as 别名]
class LoginData:
def __init__(self):
self.authentication = Authentication()
self.authentication.session_init()
if self.authentication.is_logged_in():
if self.authentication.is_admin():
responseMsg = self.authentication.get_name() + ":admin"
else:
responseMsg = self.authentication.get_name() + ":notadmin"
else:
responseMsg = self.authentication.get_error()
response.setStatus(500)
writer = response.getPrintWriter("text/html; charset=UTF-8")
writer.println(responseMsg)
writer.close()
示例3: __init__
# 需要导入模块: from authentication import Authentication [as 别名]
# 或者: from authentication.Authentication import session_init [as 别名]
class LayoutData:
def __init__(self):
self.authentication = Authentication()
self.authentication.session_init()
self.config = JsonConfig()
def getPortal(self):
return Services.getPortalManager().get(portalId)
def getPortals(self):
return Services.getPortalManager().portals
def getPortalName(self):
return self.getPortal().getDescription()
def escapeXml(self, text):
return StringEscapeUtils.escapeXml(text)
def escapeHtml(self, text):
return StringEscapeUtils.escapeHtml(text)
def unescapeHtml(self, text):
return StringEscapeUtils.unescapeHtml(text)
def md5Hash(self, data):
return md5.new(data).hexdigest()
def capitalise(self, text):
return text[0].upper() + text[1:]
def getTemplate(self, templateName):
portalName = portalId
if not Services.pageService.resourceExists(portalId, templateName, False):
portalName = Services.portalManager.DEFAULT_PORTAL_NAME
return "%s/%s" % (portalName, templateName)
def isConfigured(self):
return self.config.isConfigured()
def isNotConfigured(self):
return not self.config.isConfigured()
def isOutdated(self):
return self.config.isOutdated()
def needRestart(self):
return "true" == sessionState.get("need-restart", "false")
示例4: __init__
# 需要导入模块: from authentication import Authentication [as 别名]
# 或者: from authentication.Authentication import session_init [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)
示例5: __init__
# 需要导入模块: from authentication import Authentication [as 别名]
# 或者: from authentication.Authentication import session_init [as 别名]
class LayoutData:
def __init__(self):
self.authentication = Authentication();
self.authentication.session_init();
self.config = JsonConfig()
def getPortal(self):
return Services.getPortalManager().get(portalId)
def getPortals(self):
return Services.getPortalManager().portals
def getPortalName(self):
return self.getPortal().getDescription()
def escapeXml(self, text):
return StringEscapeUtils.escapeXml(text)
def escapeHtml(self, text):
return StringEscapeUtils.escapeHtml(text)
def unescapeHtml(self, text):
return StringEscapeUtils.unescapeHtml(text)
def md5Hash(self, data):
return md5.new(data).hexdigest()
def capitalise(self, text):
return text[0].upper() + text[1:]
def getTemplate(self, templateName):
return Services.pageService.resourceExists(portalId, templateName)
def getQueueStats(self):
return Services.getHouseKeepingManager().getQueueStats()
def getSsoProviders(self):
return security.ssoBuildLogonInterface()
示例6: __init__
# 需要导入模块: from authentication import Authentication [as 别名]
# 或者: from authentication.Authentication import session_init [as 别名]
class DeleteData:
def __init__(self):
self.authentication = Authentication()
self.authentication.session_init()
self.writer = response.getPrintWriter("text/html; charset=UTF-8")
if self.authentication.is_logged_in() and self.authentication.is_admin():
self.process()
else:
self.throw_error("Only administrative users can access this feature")
def process(self):
record = formData.get("record")
try:
Services.storage.removeObject(record)
Services.indexer.remove(record)
self.writer.println(record)
self.writer.close()
except Exception, e:
self.throw_error("Error deleting object: " + e.getMessage())
示例7: __init__
# 需要导入模块: from authentication import Authentication [as 别名]
# 或者: from authentication.Authentication import session_init [as 别名]
class LoginData:
def __init__(self):
self.authentication = Authentication()
self.authentication.session_init()
self.writer = response.getPrintWriter("text/html; charset=UTF-8")
if self.authentication.is_logged_in() and self.authentication.is_admin():
self.process()
else:
self.throw_error("Only administrative users can access this feature")
def add_user(self):
username = formData.get("field")
rolename = formData.get("hidden")
source = formData.get("source")
self.authentication.set_role_plugin(source)
self.authentication.set_role(username, rolename)
err = self.authentication.get_error()
if err is None:
self.writer.println(username)
self.writer.close()
else:
self.throw_error(err)
def change_password(self):
username = formData.get("username")
password = formData.get("password")
password_confirm = formData.get("password_confirm")
if password != password_confirm:
self.throw_error("The confirm password field does not match the password.")
else:
source = formData.get("source")
self.authentication.set_auth_plugin(source)
self.authentication.change_password(username, password)
err = self.authentication.get_error()
if err is None:
self.writer.println(username)
self.writer.close()
else:
self.throw_error(err)
def confirm_message(self):
msgId = formData.get("message")
hk = Services.getHouseKeepingManager()
if msgId is None:
self.throw_error("No message ID provided")
try:
if msgId == "ALL":
list = hk.getUserMessages();
for entry in list:
if not entry.block:
hk.confirmMessage(str(entry.id));
else:
hk.confirmMessage(msgId);
except:
error = sys.exc_info()[1]
self.throw_error(error.getMessage())
self.writer.println("ok")
self.writer.close()
def create_role(self):
rolename = formData.get("field")
source = formData.get("source")
self.authentication.set_role_plugin(source)
self.authentication.create_role(rolename)
err = self.authentication.get_error()
if err is None:
self.writer.println(rolename)
self.writer.close()
else:
self.throw_error(err)
def create_user(self):
username = formData.get("username")
password = formData.get("password")
password_confirm = formData.get("password_confirm")
if password != password_confirm:
self.throw_error("The confirm password field does not match the password.")
else:
source = formData.get("source")
self.authentication.set_auth_plugin(source)
self.authentication.create_user(username, password)
err = self.authentication.get_error()
if err is None:
#.........这里部分代码省略.........
示例8: __init__
# 需要导入模块: from authentication import Authentication [as 别名]
# 或者: from authentication.Authentication import session_init [as 别名]
class SettingsActions:
def __init__(self):
self.authentication = Authentication()
self.authentication.session_init()
self.writer = response.getPrintWriter("text/html; charset=UTF-8")
if self.authentication.is_logged_in() and self.authentication.is_admin():
self.process()
else:
print " * settings.py : AJAX : Unauthorised access"
self.throw_error("Only administrative users can access this feature")
def getWatcherFile(self):
configFile = FascinatorHome.getPathFile("watcher/config.json")
if configFile.exists():
return JsonConfigHelper(configFile)
return None
def process(self):
print " * settings.py: formData=%s" % formData
result = "{}"
portalManager = Services.getPortalManager()
portal = portalManager.get(portalId)
func = formData.get("func")
if func == "view-update":
portal.setDescription(formData.get("view-description"))
portal.setQuery(formData.get("view-query"))
portal.setSearchQuery(formData.get("view-search-query"))
print " *** ", formData.get("view-records-per-page")
portal.setRecordsPerPage(int(formData.get("view-records-per-page")))
portal.setFacetCount(int(formData.get("view-facet-count")))
portal.setFacetSort(formData.get("view-facet-sort") is not None)
portalManager.save(portal)
elif func == "general-update":
config = JsonConfig()
email = StringUtils.trimToEmpty(formData.get("general-email"))
systemEmail = StringUtils.trimToEmpty(config.get("email"))
print email, systemEmail
if systemEmail != email:
config.set("email", formData.get("general-email"), True)
config.set("configured", "true", True)
config.store(NullWriter(), True)
# mark restart
Services.getHouseKeepingManager().requestUrgentRestart()
else:
print " * settings.py: email not updated: did not change"
self.throw_error("Email address is the same! No change saved.")
elif func == "facets-update":
portal.removePath("portal/facet-fields")
fields = formData.getValues("field")
labels = formData.getValues("label")
displays = formData.getValues("display")
deletes = formData.getValues("delete")
for i in range(0, len(fields)):
field = fields[i]
if deletes[i] == "false":
portal.set("portal/facet-fields/%s/label" % field, labels[i])
portal.set("portal/facet-fields/%s/display" % field, displays[i])
portalManager.save(portal)
elif func == "backup-update":
pathIds = formData.get("pathIds").split(",")
actives = formData.getValues("backup-active")
deletes = formData.getValues("backup-delete")
if actives is None:
actives = []
# renditions = formData.getValues("backup-rendition")
# if renditions is None:
# renditions = []
queries = formData.getValues("backup-queries")
if queries is None:
queries = []
paths = HashMap()
for pathId in pathIds:
if deletes is None or pathId not in deletes:
path = formData.get("%s-path" % pathId)
pathName = path.replace("/", "_").replace("${user.home}", "")
active = str(pathId in actives).lower()
# rendition = str(pathId in renditions).lower()
query = str(pathId in queries).lower()
ignoreFilter = formData.get("%s-ignore" % pathId)
json = HashMap()
json.put("path", path)
json.put("active", active)
json.put("include-portal-query", query)
json.put("ignoreFilter", ignoreFilter)
storage = HashMap()
storage.put("type", "file-system")
filesystem = HashMap()
filesystem.put("home", path)
filesystem.put("use-link", "false")
storage.put("file-system", filesystem)
#.........这里部分代码省略.........
示例9: __init__
# 需要导入模块: from authentication import Authentication [as 别名]
# 或者: from authentication.Authentication import session_init [as 别名]
class LoginData:
def __init__(self):
self.authentication = Authentication()
self.authentication.session_init()
self.writer = response.getPrintWriter("text/html")
if self.authentication.is_logged_in() and self.authentication.is_admin():
self.process()
else:
self.throw_error("Only administrative users can access this feature")
def add_user(self):
username = formData.get("field")
rolename = formData.get("hidden")
source = formData.get("source")
self.authentication.set_role_plugin(source)
self.authentication.set_role(username, rolename)
err = self.authentication.get_error()
if err is None:
self.writer.println(username)
self.writer.close()
else:
self.throw_error(err)
def change_password(self):
username = formData.get("username")
password = formData.get("password")
password_confirm = formData.get("password_confirm")
if password != password_confirm:
self.throw_error("The confirm password field does not match the password.")
else:
source = formData.get("source")
self.authentication.set_auth_plugin(source)
self.authentication.change_password(username, password)
err = self.authentication.get_error()
if err is None:
self.writer.println(username)
self.writer.close()
else:
self.throw_error(err)
def create_role(self):
rolename = formData.get("field")
source = formData.get("source")
self.authentication.set_role_plugin(source)
self.authentication.create_role(rolename)
err = self.authentication.get_error()
if err is None:
self.writer.println(rolename)
self.writer.close()
else:
self.throw_error(err)
def create_user(self):
username = formData.get("username")
password = formData.get("password")
password_confirm = formData.get("password_confirm")
if password != password_confirm:
self.throw_error("The confirm password field does not match the password.")
else:
source = formData.get("source")
self.authentication.set_auth_plugin(source)
self.authentication.create_user(username, password)
err = self.authentication.get_error()
if err is None:
self.writer.println(username)
self.writer.close()
else:
self.throw_error(err)
def delete_role(self):
rolename = formData.get("rolename")
source = formData.get("source")
self.authentication.set_role_plugin(source)
self.authentication.delete_role(rolename)
err = self.authentication.get_error()
if err is None:
self.writer.println(rolename)
self.writer.close()
else:
self.throw_error(err)
def delete_user(self):
username = formData.get("username")
#.........这里部分代码省略.........