Exemple #1
0
def delete_profile():
    """Delete Me"""
    logging.info('[ROUTER]: Delete me')
    identity = current_identity
    try:
        user = UserService.delete_user(str(identity.id))
    except UserNotFound as e:
        logging.error('[ROUTER]: '+e.message)
        return error(status=404, detail=e.message)
    except Exception as e:
        logging.error('[ROUTER]: '+str(e))
        return error(status=500, detail='Generic Error')
    return jsonify(data=user.serialize()), 200
Exemple #2
0
def delete_user(user):
    """Delete an user"""
    logging.info('[ROUTER]: Deleting user'+user)
    identity = current_identity
    if user == '*****@*****.**':
        return error(status=403, detail='Forbidden')
    if identity.role != 'ADMIN' and identity.email != '*****@*****.**':
        return error(status=403, detail='Forbidden')
    try:
        user = UserService.delete_user(user)
    except UserNotFound as e:
        logging.error('[ROUTER]: '+e.message)
        return error(status=404, detail=e.message)
    except Exception as e:
        logging.error('[ROUTER]: '+str(e))
        return error(status=500, detail='Generic Error')
    return jsonify(data=user.serialize()), 200