Exemplo n.º 1
0
    def get(self, userId):

        user = UserModel.find_user(userId)
        
        #Se retorna un mensaje de error si el usuario no existe, por lo contrario,
        #se devuelve toda la información
        if not user:
            return {
                'message': 'The user {} doesn\'t exist'.format(userId)
            }
        
        return user, 200
Exemplo n.º 2
0
    def get(self, userId):

        user = UserModel.find_user(userId)

        #Se retorna un mensaje de error si el usuario no existe, por lo contrario,
        #se devuelve toda la información
        if not user:
            return {
                'message': Constant.THE_NON_EXISTING_REGISTRY.format(userId)
            }, 404

        del user[0]['Password']
        return user, 200
Exemplo n.º 3
0
    def get(self):
        if 'Authorization' in request.headers:
            idFromJWT = request.headers.get('Authorization')
            idFromJWT = get_jwt_identity()

            currentUser = UserModel.find_user(idFromJWT)

            if not currentUser:
                return {'message': Constant.THE_NON_EXISTING_REGISTRY}, 404

            del currentUser[0]['Password']
            return currentUser, 200

        else:
            return Constant.MISSING_AUTH, 400