예제 #1
0
파일: users.py 프로젝트: tschertel/Synergie
def update_user(user_info):

    s = app.helpers.session.get_session()

    if 'is_active' in user_info:
        user_info.is_active = '1'
    else:
        user_info.is_active = '0'

    #FIXME: mudar para não precisar de updates separados
    if user_info.password:
        result = db.update('users',
                           where='id = $id',
                           vars={'id': user_info.id},
                           name=user_info.name, is_active=user_info.is_active, comments=user_info.comments, password=create_password(user_info.password), email=user_info.email, lastupdated=int(time.time()), lastupdatedby=s.userid)
    else:
        result = db.update('users',
                           where='id = $id',
                           vars={'id': user_info.id},
                           name=user_info.name, is_active=user_info.is_active, comments=user_info.comments, email=user_info.email, lastupdated=int(time.time()), lastupdatedby=s.userid)
    logger.info(result)
    # initiate dictionary
    records = {}

    # se result == True, assume que usuario foi atualizado com sucesso
    if result == 1:
        # set response message to OK
        records['Result'] = 'OK'
    else:
        records['Result'] = 'ERROR'
        records['Message'] = 'Nenhuma informação alterada'

    return json.dumps(records)
예제 #2
0
def login(email, password):
    s = get_session()
    if users.is_correct_password(email, password):
        s.is_logged = True
        user = users.get_user_by_email(email)
        s.username = user.get('name')
        s.userid = user.get('id')
        users.update_last_login(s.userid)
        logger.info('Usuario ' + s.username + ' (' + email + ')' + ' entrou no sistema!')
        return True
    else:
        logger.error('Usuario ' + email + ' tentou logar com a senha errada!')
        return False
예제 #3
0
파일: serve.py 프로젝트: tschertel/Synergie
    '/admin/categorizations/',      'app.controllers.categorizations.Index',
    '/admin/categorizations/list/', 'app.controllers.categorizations.List',

    # Login and Logout
    '/login',                       'app.controllers.login.DoLogin',
    '/logout',                      'app.controllers.logout.DoLogout',

    # Incident Management (IcM)
    # todas as ações de incidentes são chamadas através da variável 'action'
    # ?action=list -> lista os incidentes
    # ?action=new -> cria incidente
    # ?action=update -> atualiza incidente
    '/IcM/?',                       'app.controllers.icm.Index',


    # Problem Management (PbM)
    '/PbM/',                        'app.controllers.pbm.Index',

    # Change management (ChM)
    '/ChM/',                        'app.controllers.chm.Index',

    # Configuration Management (CfM)
    '/CfM/',                        'app.controllers.cfm.Index',
)

if __name__ == "__main__":
    synergie_app = web.application(urls, globals(), autoreload=True)
    session.add_session(synergie_app)
    logger.info('Iniciando o servidor!')
    synergie_app.run()
예제 #4
0
파일: teste.py 프로젝트: tschertel/Synergie
 def POST(self):
     logger.info(web.data())
     return teste.List(web.data())