本文整理汇总了Python中src.models.user.User.get_user_permissions方法的典型用法代码示例。如果您正苦于以下问题:Python User.get_user_permissions方法的具体用法?Python User.get_user_permissions怎么用?Python User.get_user_permissions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类src.models.user.User
的用法示例。
在下文中一共展示了User.get_user_permissions方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: admin_edit_profile_page
# 需要导入模块: from src.models.user import User [as 别名]
# 或者: from src.models.user.User import get_user_permissions [as 别名]
def admin_edit_profile_page(user):
universities = University.get_uni_list()
profile = User.find_by_email(user)
mypermissions = User.get_user_permissions(session['email'])
permissions = [permission_level for permission_level in Database.find(Permissions.COLLECTION, {})]
return render_template('edit-profile.html', user=user, universities=universities, profile=profile,
permissions=permissions, mypermissions=mypermissions)
示例2: view_event_registrations
# 需要导入模块: from src.models.user import User [as 别名]
# 或者: from src.models.user.User import get_user_permissions [as 别名]
def view_event_registrations(event_id):
if session.contains('email') and session['email'] is not None:
if User.get_user_permissions(session['email']) == 'admin':
users = EventRegister.list_registered_users(event_id)
return render_template('admin-event-registrations.html', users=users, event_id=event_id)
else:
abort(401)
示例3: edit_uni_page
# 需要导入模块: from src.models.user import User [as 别名]
# 或者: from src.models.user.User import get_user_permissions [as 别名]
def edit_uni_page():
if session.contains('email') and session['email'] is not None:
if User.get_user_permissions(session['email']) == 'admin':
universities = University.get_uni_list()
return render_template('university-update.html', universities=universities)
else:
abort(401)
示例4: admin_view_profile
# 需要导入模块: from src.models.user import User [as 别名]
# 或者: from src.models.user.User import get_user_permissions [as 别名]
def admin_view_profile(user_email):
if session.contains('email') and session['email'] is not None:
if User.get_user_permissions(session['email']) == 'admin':
profile = User.find_by_email(user_email)
events = profile.get_registered_events(profile.email)
totalpoints = profile.total_points()
attended_events = profile.get_all_attended(profile.email)
current_date = datetime.now()
permissions = User.get_user_permissions(session['email'])
user_points = profile.data['points'] if 'points' in profile.data.keys() else None
awards = []
if user_points is not None:
awards = Award.check_user_awards(profile.data['points'])
return render_template('user-profile.html', email=user_email, profile=profile, events=events, totalpoints=totalpoints,
rank=profile.get_point_rank(), permissions=permissions, date=current_date,
attended_events=attended_events, awards=awards)
else:
abort(401)
示例5: load_user_list
# 需要导入模块: from src.models.user import User [as 别名]
# 或者: from src.models.user.User import get_user_permissions [as 别名]
def load_user_list():
if User.get_user_permissions(session['email']) == 'admin':
users = User.get_user_list()
return render_template("admin-user-list.html", users=users)
else:
abort(500)