本文整理汇总了Python中app.helpers.data.DataManager.update_permissions方法的典型用法代码示例。如果您正苦于以下问题:Python DataManager.update_permissions方法的具体用法?Python DataManager.update_permissions怎么用?Python DataManager.update_permissions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app.helpers.data.DataManager
的用法示例。
在下文中一共展示了DataManager.update_permissions方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: index_view
# 需要导入模块: from app.helpers.data import DataManager [as 别名]
# 或者: from app.helpers.data.DataManager import update_permissions [as 别名]
def index_view(self):
if request.method == 'POST':
DataManager.update_permissions(request.form)
perms = dict()
roles = DataGetter.get_roles()
services = DataGetter.get_services()
get_permission = DataGetter.get_permission_by_role_service
for role in roles:
perms[role] = dict()
for service in services:
perms[role][service.name] = dict()
p = get_permission(role=role, service=service)
if not p:
perms[role][service.name]['c'] = False
perms[role][service.name]['r'] = False
perms[role][service.name]['u'] = False
perms[role][service.name]['d'] = False
else:
perms[role][service.name]['c'] = p.can_create
perms[role][service.name]['r'] = p.can_read
perms[role][service.name]['u'] = p.can_update
perms[role][service.name]['d'] = p.can_delete
return self.render(
'/gentelella/admin/super_admin/permissions/permissions.html',
perms=sorted(perms.iteritems(),
key=lambda (k, v): k.name))
示例2: event_roles_view
# 需要导入模块: from app.helpers.data import DataManager [as 别名]
# 或者: from app.helpers.data.DataManager import update_permissions [as 别名]
def event_roles_view():
if request.method == 'POST':
DataManager.update_permissions(request.form)
return redirect(url_for('.index_view'))