Exemplo n.º 1
0
def main_character_change(request, char_id):
    logger.debug("main_character_change called by user %s for character id %s" % (request.user, char_id))
    if EveManager.check_if_character_owned_by_user(char_id, request.user):
        AuthServicesInfoManager.update_main_char_Id(char_id, request.user)
        set_state(request.user)
        return HttpResponseRedirect("/characters")
    return HttpResponseRedirect("/characters")
Exemplo n.º 2
0
def main_character_change(request, char_id):
    if EveManager.check_if_character_owned_by_user(char_id, request.user):
        previousmainid = AuthServicesInfoManager.get_auth_service_info(request.user).main_char_id
        AuthServicesInfoManager.update_main_char_Id(char_id, request.user)
        # Check if character is in the alliance
        character_info = EveManager.get_character_by_id(char_id)
        corporation_info = EveManager.get_corporation_info_by_id(character_info.corporation_id)

        if EveManager.get_charater_alliance_id_by_id(char_id) == settings.ALLIANCE_ID:
            add_member_permission(request.user, 'alliance_member')
            add_user_to_group(request.user, settings.DEFAULT_ALLIANCE_GROUP)
            add_user_to_group(request.user,
                              generate_corp_group_name(EveManager.get_character_by_id(char_id).corporation_name))

        elif corporation_info != None:
            if corporation_info.is_blue:
                add_member_permission(request.user, 'blue_member')
                add_user_to_group(request.user, settings.DEFAULT_BLUE_GROUP)
                AuthServicesInfoManager.update_is_blue(True, request.user)
            else:
                if check_if_user_has_permission(request.user, 'alliance_member'):
                    disable_alliance_member(request.user, previousmainid)

                if check_if_user_has_permission(request.user, 'blue_member'):
                    disable_blue_member(request.user)
        else:
            # TODO: disable serivces
            if check_if_user_has_permission(request.user, 'alliance_member'):
                disable_alliance_member(request.user, previousmainid)

            if check_if_user_has_permission(request.user, 'blue_member'):
                disable_blue_member(request.user)

        return HttpResponseRedirect("/characters")
    return HttpResponseRedirect("/characters")
Exemplo n.º 3
0
def main_character_change(request, char_id):
    logger.debug(
        "main_character_change called by user %s for character id %s" %
        (request.user, char_id))
    if EveManager.check_if_character_owned_by_user(char_id, request.user):
        AuthServicesInfoManager.update_main_char_Id(char_id, request.user)
        set_state(request.user)
        return HttpResponseRedirect("/characters/")
    return HttpResponseRedirect("/characters/")
Exemplo n.º 4
0
def deactivate_services(user):
    authinfo = AuthServicesInfoManager.get_auth_service_info(user)
    if authinfo.mumble_username != "":
        MumbleManager.delete_user(authinfo.mumble_username)
        AuthServicesInfoManager.update_user_mumble_info("", "", user)
    if authinfo.jabber_username != "":
        JabberManager.delete_user(authinfo.jabber_username)
        AuthServicesInfoManager.update_user_jabber_info("", "", user)
    if authinfo.forum_username != "":
        ForumManager.disable_user(authinfo.forum_username)
        AuthServicesInfoManager.update_user_forum_info("", "", user)
    AuthServicesInfoManager.update_main_char_Id("", user)
Exemplo n.º 5
0
def main_character_change(request, char_id):
    if EveManager.check_if_character_owned_by_user(char_id, request.user):
        previousmainid = AuthServicesInfoManager.get_auth_service_info(
            request.user).main_char_id
        AuthServicesInfoManager.update_main_char_Id(char_id, request.user)
        # Check if character is in the alliance
        character_info = EveManager.get_character_by_id(char_id)
        corporation_info = EveManager.get_corporation_info_by_id(
            character_info.corporation_id)

        if EveManager.get_charater_alliance_id_by_id(
                char_id) == settings.ALLIANCE_ID:
            add_member_permission(request.user, 'alliance_member')
            add_user_to_group(request.user, settings.DEFAULT_ALLIANCE_GROUP)
            add_user_to_group(
                request.user,
                generate_corp_group_name(
                    EveManager.get_character_by_id(char_id).corporation_name))

        elif corporation_info != None:
            if corporation_info.is_blue:
                add_member_permission(request.user, 'blue_member')
                add_user_to_group(request.user, settings.DEFAULT_BLUE_GROUP)
                AuthServicesInfoManager.update_is_blue(True, request.user)
            else:
                if check_if_user_has_permission(request.user,
                                                'alliance_member'):
                    disable_alliance_member(request.user, previousmainid)

                if check_if_user_has_permission(request.user, 'blue_member'):
                    disable_blue_member(request.user)
        else:
            # TODO: disable serivces
            if check_if_user_has_permission(request.user, 'alliance_member'):
                disable_alliance_member(request.user, previousmainid)

            if check_if_user_has_permission(request.user, 'blue_member'):
                disable_blue_member(request.user)

        return HttpResponseRedirect("/characters")
    return HttpResponseRedirect("/characters")
Exemplo n.º 6
0
def main_character_change(request, char_id):
    logger.debug("main_character_change called by user %s for character id %s" % (request.user, char_id))
    if EveManager.check_if_character_owned_by_user(char_id, request.user):
        previousmainid = AuthServicesInfoManager.get_auth_service_info(request.user).main_char_id
        AuthServicesInfoManager.update_main_char_Id(char_id, request.user)
        # Check if character is in the alliance
        character_info = EveManager.get_character_by_id(char_id)
        corporation_info = EveManager.get_corporation_info_by_id(character_info.corporation_id)
        logger.debug("User %s changing main character to %s in corp %s" % (request.user, character_info, corporation_info))
        if (settings.IS_CORP and EveManager.get_charater_corporation_id_by_id(char_id) == settings.CORP_ID) or (not settings.IS_CORP and EveManager.get_charater_alliance_id_by_id(char_id) == settings.ALLIANCE_ID):
            add_member_permission(request.user, 'member')
            add_user_to_group(request.user, settings.DEFAULT_AUTH_GROUP)
            add_user_to_group(request.user,
                              generate_corp_group_name(EveManager.get_character_by_id(char_id).corporation_name))
            logger.info("User %s transitioned to full member by chaning main character to %s" % (request.user, character_info))

        elif corporation_info != None:
            if corporation_info.is_blue:
                add_member_permission(request.user, 'blue_member')
                add_user_to_group(request.user, settings.DEFAULT_BLUE_GROUP)
                AuthServicesInfoManager.update_is_blue(True, request.user)
                logger.info("User %s transitioned to blue by changing main character to %s" % (request.user, character_info))
            else:
                if check_if_user_has_permission(request.user, 'member'):
                    disable_member(request.user, previousmainid)

                if check_if_user_has_permission(request.user, 'blue_member'):
                    disable_blue_member(request.user)
                logger.info("User %s disabled as new main character %s not member nor blue." % (request.user, character_info))
        else:
            # TODO: disable serivces
            if check_if_user_has_permission(request.user, 'member'):
                disable_member(request.user, previousmainid)

            if check_if_user_has_permission(request.user, 'blue_member'):
                disable_blue_member(request.user)
            logger.info("User %s disabled as new main character %s does not have corp model to check." % (request.user, character_info))

        return HttpResponseRedirect("/characters")
    return HttpResponseRedirect("/characters")