admin.py 912 Bytes
Newer Older
1
""" Main Controller to run the application with some privileges.
2 3 4

"""

5
@auth.requires(True, requires_login=not request.is_local)
6
def index():
7

8 9 10
    # login procedure is active
    if session.auth:
        roles =  session.auth.user_groups.values()
11

12 13 14
        if roles:
            session.role = roles[0]
            
15 16 17 18 19 20
            # inhibit USER login from the application properties
            if session.role == USER:
                authorize_login = current.app.authorize_user_login 
                if authorize_login.lower() not in ('true', 'yes'):
                    session.role = None
            
21 22 23 24
        else:
            return 'The user role is not defined'
        
    # no login procedure      
25
    else:
26 27
        session.role = ADMIN
    
28 29 30
    if 'debug' in request.vars:
        return LOAD('plugin_dbui', 'debug', vars=request.vars)
    
31
    return LOAD('plugin_dbui', 'index', vars=request.vars)