Esempio n. 1
0
    def delete(self):
        logger.debug("Inside delete me")

        data = request.get_json(force=True)
        keep = data['keep']

        try:
            user(keep).deleteUser(data['ID_USER'])
            return self.response.getResponse(200,
                                             "Successfull on delete action")
        except Exception as e:
            return self.response.getResponse(500, e.args[0])
Esempio n. 2
0
    def post(self):
        logger.debug("Inside post me")

        data = request.get_json(force=True)
        keep = data['keep']

        u = mapUser(int(data['ID_USER']), data['NAME'], data['PASSWORD'],
                    data['EMAIL'], int(data['KIND)F_USER']),
                    int(data['USER_ENABLED']))

        try:
            user(keep).saveUser(u)
        except Exception as err:
            return self.response.getResponse(500, err.args[0])

        return self.response.getResponse(200, "User saved")
Esempio n. 3
0
    def get(self):

        logger.debug("Try to get users list")

        data = request.get_json(force=True)
        keep = data['keep']
        name = data['name'] if len(data['name']) > 0 else None
        email = data['email'] if len(data['email']) > 0 else None

        result = user(keep).listUsers(name, email)

        return self.response.getResponse(200, result)
Esempio n. 4
0
def deleteUser():
    rec = json.loads(request.get_data())

    ID_USER = rec['ID_USER']
    keep = rec['keep']
    idUser = rec['idUser']

    user1 = user(keep, idUser)
    user1.testDeleteUser(ID_USER)

    del user1

    return "Ok"
Esempio n. 5
0
def getUser():

    rec = json.loads(request.get_data())

    ID_USER = rec['ID_USER']
    keep = rec['keep']
    idUser = rec['idUser']

    user1 = user(keep, idUser)
    result = user1.testGetUser(ID_USER)

    del user1

    return result
Esempio n. 6
0
def listUsers():
    rec = json.loads(request.get_data())

    nome = rec['name']
    email = rec['email']
    idUser = rec['idUser']

    user1 = user(rec['keep'], idUser)
    
    result = user1.testListOfUsers(nome, email)

    del user1

    return result
Esempio n. 7
0
def authenticateUser():
    rec = json.loads(request.get_data())

    userx =  rec['EMAIL']
    password = rec['PASSWORD']
    idUser = rec['idUser']

    try:
        user1 = user(None, idUser)
        backData = user1.testAuthenticate(userx, password)
        del user1

        return backData
    except Exception as ex:
        return jsonify({ "message": ex.args[0] }), 500
Esempio n. 8
0
def saveUser():
    rec = json.loads(request.get_data())

    ID_USER = rec['ID_USER']
    NAME_USER = rec['NAME_USER']
    EMAIL = rec['EMAIL']
    PASSWORD_USER = rec['NAME_USER']
    KIND_OF_USER = rec['KIND_OF_USER']
    USER_ENABLED = rec['USER_ENABLED']
    keep = rec['keep']
    idUser = rec['idUser']

    table = mapUser(ID_USER, NAME_USER, PASSWORD_USER, EMAIL, USER_ENABLED, KIND_OF_USER)

    user1 = user(keep, idUser)
    retorno = user1.testSaveUser(table)

    del user1

    return retorno