def admin(): """Super-admin page; allows roles to be changed. Don't advertise. Misuse will totally break everything.""" aaa.require(role='admin', fail_redirect='/sorry_page') return dict(current_user=aaa.current_user, users=aaa.list_users(), roles=aaa.list_roles())
def admin(): """Regular, more user-friendly admin.""" aaa.require(role='admin', fail_redirect='/sorry_page') return dict( current_user=aaa.current_user, users=aaa.list_users(), roles=aaa.list_roles() )
def admin(): """Super-admin page; allows roles to be changed. Don't advertise. Misuse will totally break everything.""" aaa.require(role='admin', fail_redirect='/sorry_page') return dict( current_user=aaa.current_user, users=aaa.list_users(), roles=aaa.list_roles() )
def toggle_role(username): aaa.require(role='admin', fail_redirect='/sorry_page') user = aaa.user(username) role = user.role try: if role == 'user': user.update(role='admin') else: user.update(role='user') except Exception as e: return e.message bottle.redirect('/admin')
def admin(): """Regular, more user-friendly admin.""" aaa.require(role='admin', fail_redirect='/sorry_page') return dict(current_user=aaa.current_user, users=aaa.list_users(), roles=aaa.list_roles())
def show_current_user_role(): """Show current user role""" session = bottle.request.environ.get('beaker.session') print "Session from simple_webapp", repr(session) aaa.require(fail_redirect='/login') return aaa.current_user.role