def get_user_data(center=False): data = {'center': session['center']} data['centers'], = zip(*current_user.centers_list()) if center == 'all': data['perms_list'] = current_user.user_perms_for(center) data['perms'] = current_user.user_perms_for(data['center']) return data
def decorated_function(*args, **kwargs): perms = current_user.user_perms_for(session['center']) if not perms or not perms.moderator: flash('You Do Not Have Permission to Access This Page!', 'error') return redirect(url_for('dashboard')) return func(*args, **kwargs)