def remove_user():
    global current_user
    global current_event
    if not current_user:
        add_output('You have to log in first. \n')
    event_id = event_id_input.get()
    current_event = EventController.retrieve_event(event_id)
    if current_event == Errors.MISSING.name:
        add_output('No such event. \n')
        current_event = None
        return
    elif current_event == Errors.FAILURE.name:
        return_failure()
        current_event = None
        return
    if current_user.uid != current_event.hosts:
        add_output('You have to be the host to remove attendees. \n')
        current_event = None
        return

    user_id = user_id_input.get()
    result = EventController.remove_user(user_id, current_event)
    if result == Errors.MISSING.name:
        add_output('User did not attend. \n')
        current_event = None
        return
    elif result == Errors.FAILURE.name:
        return_failure()
        current_event = None
        return
    add_output('User #' + result[0] + ' removed from event #' + result[1] +
               '. \n')
    return
Beispiel #2
0
def remove_user(data):
    result = EventController.remove_user(data)
    return result