本文整理汇总了Python中models.user.User.get_roles方法的典型用法代码示例。如果您正苦于以下问题:Python User.get_roles方法的具体用法?Python User.get_roles怎么用?Python User.get_roles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.user.User
的用法示例。
在下文中一共展示了User.get_roles方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: role_add
# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import get_roles [as 别名]
def role_add():
values = json.loads(request.form['params'])
try:
role_id = User.add_role(values)
return jsonify(id=role_id, roles=User.get_roles())
except Exception as ex:
return jsonify(error=str(ex))
示例2: role_drop
# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import get_roles [as 别名]
def role_drop():
role_id = json.loads(request.args['id'])
success = User.delete_role(role_id)
if not success:
msg = 'Record not deleted for unknown reason. Contact admin.'
return jsonify(error=msg)
roles = User.get_roles()
return jsonify(roles=roles)
示例3: user_mgt
# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import get_roles [as 别名]
def user_mgt():
users = User.get_users()
roles = User.get_roles()
return render_template(
'users.html',
title='allocat users',
users=users,
roles=roles
)
示例4: role_update
# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import get_roles [as 别名]
def role_update():
values = json.loads(request.form['params'])
try:
numrows = User.update_role(values)
if numrows != 1:
msg = 'Record not updated for unknown reason. Contact admin.'
return jsonify(error=msg)
return jsonify(id=values['id'], roles=User.get_roles())
except Exception as ex:
return jsonify(error=str(ex))
示例5: user_mgt
# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import get_roles [as 别名]
def user_mgt():
from models.precinct import Precinct
dao = Dao(stateful=True)
jurisdictions = Precinct.get_jurisdictions(dao)
precincts = Precinct.get_all(dao)
roles = User.get_roles(dao)
users = User.get_users(dao)
precinct_admins = User.get_precinct_admins(dao)
dao.close()
return render_template(
'users.html',
title='Bluestreets users',
jurisdictions=jurisdictions,
precincts=[precinct.serialize() for precinct in precincts],
roles=roles,
users=users,
precinct_admins=precinct_admins
)