本文整理汇总了Python中module.webui.PYLOAD.getAllUserData方法的典型用法代码示例。如果您正苦于以下问题:Python PYLOAD.getAllUserData方法的具体用法?Python PYLOAD.getAllUserData怎么用?Python PYLOAD.getAllUserData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类module.webui.PYLOAD
的用法示例。
在下文中一共展示了PYLOAD.getAllUserData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: admin
# 需要导入模块: from module.webui import PYLOAD [as 别名]
# 或者: from module.webui.PYLOAD import getAllUserData [as 别名]
def admin():
# convert to dict
user = dict([(name, toDict(y)) for name, y in PYLOAD.getAllUserData().iteritems()])
perms = permlist()
for data in user.itervalues():
data["perms"] = {}
get_permission(data["perms"], data["permission"])
data["perms"]["admin"] = True if data["role"] is 0 else False
s = request.environ.get("beaker.session")
if request.environ.get("REQUEST_METHOD", "GET") == "POST":
for name in user:
if request.POST.get("%s|admin" % name, False):
user[name]["role"] = 0
user[name]["perms"]["admin"] = True
elif name != s["name"]:
user[name]["role"] = 1
user[name]["perms"]["admin"] = False
# set all perms to false
for perm in perms:
user[name]["perms"][perm] = False
for perm in request.POST.getall("%s|perms" % name):
user[name]["perms"][perm] = True
user[name]["permission"] = set_permission(user[name]["perms"])
PYLOAD.setUserPermission(name, user[name]["permission"], user[name]["role"])
return render_to_response("admin.html", {"users": user, "permlist": perms}, [pre_processor])