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

"""

LE GAC Renaud's avatar
LE GAC Renaud committed
5
@auth.requires_login()
6
def index():
7

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

12 13 14 15 16 17 18
        if roles:
            session.role = roles[0]
            
        else:
            return 'The user role is not defined'
        
    # no login procedure      
19
    else:
20 21
        session.role = ADMIN
    
22 23 24
    if 'debug' in request.vars:
        return LOAD('plugin_dbui', 'debug', vars=request.vars)
    
25
    return LOAD('plugin_dbui', 'index', vars=request.vars)