def login(): if not current_user.is_authenticated: return render_template('login.html') if (current_user.get_urole() == 'Admin'): return redirect(url_for('main.profile')) elif (current_user.get_urole() == 'Vendor'): return redirect(url_for('vendor.index'))
def hub(): """ Redirige al dashboard correcto segun rol """ if (current_user.get_urole() == 2): return redirect(url_for('home.dashboard_admin')) elif (current_user.get_urole() == 1): return redirect(url_for('home.dashboard_editor')) else: return redirect(url_for('home.noaccess'))
def decorated_view(*args, **kwargs): if not current_user.is_authenticated: return lm.unauthorized() if role == Roles.ALL: return fn(*args, **kwargs) elif role == Roles.BOTOWNER and current_user.get_urole() not in [ Roles.BOTOWNER, Roles.ALL ]: return "You should be atleast a {}".format(role) elif role == Roles.SUPERVISOR and current_user.get_urole() not in [ Roles.SUPERVISOR, Roles.BOTOWNER, Roles.ALL ]: return "You should be atleast a {}".format(role) else: return fn(*args, **kwargs)
def decorated_view(*args, **kwargs): if not current_user.is_authenticated: return redirect(url_for('login')) urole = current_user.get_urole() if ((urole != role) and (role != "ANY")): return login.unauthorized() return fn(*args, **kwargs)
def decorated_view(*args, **kwargs): if not current_user.is_authenticated: return redirect(url_for('login', next=request.url)) urole = current_user.get_urole() if (urole < role): return current_app.login_manager.unauthorized() return fn(*args, **kwargs)
def decorated_view(*args, **kwargs): if not current_user.is_authenticated: return app.login_manager.unauthorized() urole = current_user.get_urole() if ((urole != role) and (role != "user")): return app.login_manager.unauthorized() return fn(*args, **kwargs)
def decorated_view(*args, **kwargs): if not current_user.is_authenticated: return app.login_manager.unauthorized() urole = current_user.get_urole() if ((urole != role) and (role != "ANY")): return render_template('unauthorized_page.html') return fn(*args, **kwargs)
def index(): if not current_user.is_authenticated: return render_template(PAGES['logged_out']["index"]) else: if current_user.get_urole() in [Roles.BOTOWNER, Roles.ALL]: return render_template(PAGES['logged_in']["index"]) else: return render_template('supervisor/landing.html')
def decorated_view(*args, **kwargs): if not (current_user and current_user.is_authenticated): return login_manager.unauthorized() urole = current_user.get_urole() if ((urole != role) and (role != "ANY")): return login_manager.unauthorized() return func(*args, **kwargs)
def dashboard_editor(): """ Pagina de panel de control de edicion restringe el acceso a cosas privadas de las personas como el seguimiento """ if not current_user.get_urole() == 1: return redirect(url_for('home.noaccess')) panel_p = datos_personas() panel_f = datos_familias() panel_gc = datos_gruposcaseros() return render_template('home/index_editor.html', panel_p=panel_p, panel_f=panel_f, panel_gc=panel_gc)
def check_edit_or_admin(): """ Si no es admin o editor lo manda al inicio """ if not current_user.get_urole() >= 1: return redirect(url_for("home.hub"))