コード例 #1
0
ファイル: common_task.py プロジェクト: Cafune/allianceauth
def deactivate_services(user):
    logger.debug("Deactivating services for user %s" % user)
    authinfo = AuthServicesInfoManager.get_auth_service_info(user)
    if authinfo.mumble_username and authinfo.mumble_username != "":
        logger.debug("User %s has mumble account %s. Deleting." % (user, authinfo.mumble_username))
        MumbleManager.delete_user(authinfo.mumble_username)
        AuthServicesInfoManager.update_user_mumble_info("", "", user)
    if authinfo.jabber_username and authinfo.jabber_username != "":
        logger.debug("User %s has jabber account %s. Deleting." % (user, authinfo.jabber_username))
        OpenfireManager.delete_user(authinfo.jabber_username)
        AuthServicesInfoManager.update_user_jabber_info("", "", user)
    if authinfo.forum_username and authinfo.forum_username != "":
        logger.debug("User %s has forum account %s. Deleting." % (user, authinfo.forum_username))
        Phpbb3Manager.disable_user(authinfo.forum_username)
        AuthServicesInfoManager.update_user_forum_info("", "", user)
    if authinfo.ipboard_username and authinfo.ipboard_username != "":
        logger.debug("User %s has ipboard account %s. Deleting." % (user, authinfo.ipboard_username))
        IPBoardManager.disable_user(authinfo.ipboard_username)
        AuthServicesInfoManager.update_user_forum_info("", "", user)
    if authinfo.teamspeak3_uid and authinfo.teamspeak3_uid != "":
        logger.debug("User %s has mumble account %s. Deleting." % (user, authinfo.teamspeak3_uid))
        Teamspeak3Manager.delete_user(authinfo.teamspeak3_uid)
        AuthServicesInfoManager.update_user_teamspeak3_info("", "", user)
    if authinfo.discord_uid and authinfo.discord_uid != "":
        logger.debug("User %s has discord account %s. Deleting." % (user, authinfo.discord_uid))
        DiscordManager.delete_user(authinfo.discord_uid)
        AuthServicesInfoManager.update_user_discord_info("", user)
コード例 #2
0
ファイル: views.py プロジェクト: Tuqiri/allianceauth
def reset_teamspeak3_perm(request):
    logger.debug("reset_teamspeak3_perm called by user %s" % request.user)
    authinfo = AuthServicesInfoManager.get_auth_service_info(request.user)
    character = EveManager.get_character_by_id(authinfo.main_char_id)
    logger.debug("Deleting TS3 user for user %s" % request.user)
    Teamspeak3Manager.delete_user(authinfo.teamspeak3_uid)

    remove_all_syncgroups_for_service(request.user, "teamspeak3")

    if check_if_user_has_permission(request.user, "blue_member"):
        logger.debug("Generating new permission key for blue user %s with main character %s" % (request.user, character))
        result = Teamspeak3Manager.generate_new_blue_permissionkey(authinfo.teamspeak3_uid, character.character_name,
                                                                   character.corporation_ticker)
    else:
        logger.debug("Generating new permission key for user %s with main character %s" % (request.user, character))
        result = Teamspeak3Manager.generate_new_permissionkey(authinfo.teamspeak3_uid, character.character_name,
                                                              character.corporation_ticker)

    # if blank we failed
    if result != "":
        AuthServicesInfoManager.update_user_teamspeak3_info(result[0], result[1], request.user)
        logger.debug("Updated authserviceinfo for user %s with TS3 credentials. Updating groups." % request.user)
        update_teamspeak3_groups(request.user)
        logger.info("Successfully reset TS3 permission key for user %s" % request.user)
        return HttpResponseRedirect("/services/")
    logger.error("Unsuccessful attempt to reset TS3 permission key for user %s" % request.user)
    return HttpResponseRedirect("/")
コード例 #3
0
def reset_teamspeak3_perm(request):
    logger.debug("reset_teamspeak3_perm called by user %s" % request.user)
    authinfo = AuthServicesInfoManager.get_auth_service_info(request.user)
    character = EveManager.get_character_by_id(authinfo.main_char_id)
    logger.debug("Deleting TS3 user for user %s" % request.user)
    Teamspeak3Manager.delete_user(authinfo.teamspeak3_uid)

    if check_if_user_has_permission(request.user, "blue_member"):
        logger.debug("Generating new permission key for blue user %s with main character %s" % (request.user, character))
        result = Teamspeak3Manager.generate_new_blue_permissionkey(authinfo.teamspeak3_uid, character.character_name,
                                                                   character.corporation_ticker)
    else:
        logger.debug("Generating new permission key for user %s with main character %s" % (request.user, character))
        result = Teamspeak3Manager.generate_new_permissionkey(authinfo.teamspeak3_uid, character.character_name,
                                                              character.corporation_ticker)

    # if blank we failed
    if result != "":
        AuthServicesInfoManager.update_user_teamspeak3_info(result[0], result[1], request.user)
        logger.debug("Updated authserviceinfo for user %s with TS3 credentials. Updating groups." % request.user)
        update_teamspeak3_groups.delay(request.user)
        logger.info("Successfully reset TS3 permission key for user %s" % request.user)
        return HttpResponseRedirect("/services/")
    logger.error("Unsuccessful attempt to reset TS3 permission key for user %s" % request.user)
    return HttpResponseRedirect("/")
コード例 #4
0
ファイル: views.py プロジェクト: gitter-badger/allianceauth
def activate_teamspeak3(request):
    logger.debug("activate_teamspeak3 called by user %s" % request.user)
    authinfo = AuthServicesInfoManager.get_auth_service_info(request.user)
    character = EveManager.get_character_by_id(authinfo.main_char_id)
    if check_if_user_has_permission(request.user, "blue_member"):
        logger.debug(
            "Adding TS3 user for blue user %s with main character %s" %
            (request.user, character))
        result = Teamspeak3Manager.add_blue_user(character.character_name,
                                                 character.corporation_ticker)
    else:
        logger.debug("Adding TS3 user for user %s with main character %s" %
                     (request.user, character))
        result = Teamspeak3Manager.add_user(character.character_name,
                                            character.corporation_ticker)

    # if its empty we failed
    if result[0] is not "":
        AuthServicesInfoManager.update_user_teamspeak3_info(
            result[0], result[1], request.user)
        logger.debug(
            "Updated authserviceinfo for user %s with TS3 credentials. Updating groups."
            % request.user)
        update_teamspeak3_groups(request.user)
        logger.info("Succesfully activated TS3 for user %s" % request.user)
        return HttpResponseRedirect("/services/")
    logger.error("Unsuccessful attempt to activate TS3 for user %s" %
                 request.user)
    return HttpResponseRedirect("/dashboard")
コード例 #5
0
def deactivate_services(user):
    change = False
    logger.debug("Deactivating services for user %s" % user)
    authinfo = AuthServicesInfo.objects.get_or_create(user=user)[0]
    if authinfo.mumble_username and authinfo.mumble_username != "":
        logger.debug("User %s has mumble account %s. Deleting." % (user, authinfo.mumble_username))
        MumbleManager.delete_user(authinfo.mumble_username)
        AuthServicesInfoManager.update_user_mumble_info("", user)
        change = True
    if authinfo.jabber_username and authinfo.jabber_username != "":
        logger.debug("User %s has jabber account %s. Deleting." % (user, authinfo.jabber_username))
        OpenfireManager.delete_user(authinfo.jabber_username)
        AuthServicesInfoManager.update_user_jabber_info("", user)
        change = True
    if authinfo.forum_username and authinfo.forum_username != "":
        logger.debug("User %s has forum account %s. Deleting." % (user, authinfo.forum_username))
        Phpbb3Manager.disable_user(authinfo.forum_username)
        AuthServicesInfoManager.update_user_forum_info("", user)
        change = True
    if authinfo.ipboard_username and authinfo.ipboard_username != "":
        logger.debug("User %s has ipboard account %s. Deleting." % (user, authinfo.ipboard_username))
        IPBoardManager.disable_user(authinfo.ipboard_username)
        AuthServicesInfoManager.update_user_ipboard_info("", user)
        change = True
    if authinfo.teamspeak3_uid and authinfo.teamspeak3_uid != "":
        logger.debug("User %s has mumble account %s. Deleting." % (user, authinfo.teamspeak3_uid))
        Teamspeak3Manager.delete_user(authinfo.teamspeak3_uid)
        AuthServicesInfoManager.update_user_teamspeak3_info("", "", user)
        change = True
    if authinfo.discord_uid and authinfo.discord_uid != "":
        logger.debug("User %s has discord account %s. Deleting." % (user, authinfo.discord_uid))
        DiscordOAuthManager.delete_user(authinfo.discord_uid)
        AuthServicesInfoManager.update_user_discord_info("", user)
        change = True
    if authinfo.xenforo_username and authinfo.xenforo_password != "":
        logger.debug("User %s has a XenForo account %s. Deleting." % (user, authinfo.xenforo_username))
        XenForoManager.disable_user(authinfo.xenforo_username)
        AuthServicesInfoManager.update_user_xenforo_info("", user)
        change = True
    if authinfo.market_username and authinfo.market_username != "":
        logger.debug("User %s has a Market account %s. Deleting." % (user, authinfo.market_username))
        marketManager.disable_user(authinfo.market_username)
        AuthServicesInfoManager.update_user_market_info("", user)
        change = True
    if authinfo.discourse_enabled:
        logger.debug("User %s has a Discourse account. Disabling login." % user)
        DiscourseManager.disable_user(user)
        authinfo.discourse_enabled = False
        authinfo.save()
        change = True
    if authinfo.smf_username and authinfo.smf_username != "":
        logger.debug("User %s has a SMF account %s. Deleting." % (user, authinfo.smf_username))
        smfManager.disable_user(authinfo.smf_username)
        AuthServicesInfoManager.update_user_smf_info("", user)
        change = True
    if change:
        notify(user, "Services Disabled", message="Your services accounts have been disabled.", level="danger")
コード例 #6
0
ファイル: tasks.py プロジェクト: Adarnof/allianceauth
def deactivate_services(user):
    change = False
    logger.debug("Deactivating services for user %s" % user)
    authinfo = AuthServicesInfo.objects.get_or_create(user=user)[0]
    if authinfo.mumble_username and authinfo.mumble_username != "":
        logger.debug("User %s has mumble account %s. Deleting." % (user, authinfo.mumble_username))
        MumbleManager.delete_user(authinfo.mumble_username)
        AuthServicesInfoManager.update_user_mumble_info("", user)
        change = True
    if authinfo.jabber_username and authinfo.jabber_username != "":
        logger.debug("User %s has jabber account %s. Deleting." % (user, authinfo.jabber_username))
        OpenfireManager.delete_user(authinfo.jabber_username)
        AuthServicesInfoManager.update_user_jabber_info("", user)
        change = True
    if authinfo.forum_username and authinfo.forum_username != "":
        logger.debug("User %s has forum account %s. Deleting." % (user, authinfo.forum_username))
        Phpbb3Manager.disable_user(authinfo.forum_username)
        AuthServicesInfoManager.update_user_forum_info("", user)
        change = True
    if authinfo.ipboard_username and authinfo.ipboard_username != "":
        logger.debug("User %s has ipboard account %s. Deleting." % (user, authinfo.ipboard_username))
        IPBoardManager.disable_user(authinfo.ipboard_username)
        AuthServicesInfoManager.update_user_ipboard_info("", user)
        change = True
    if authinfo.teamspeak3_uid and authinfo.teamspeak3_uid != "":
        logger.debug("User %s has mumble account %s. Deleting." % (user, authinfo.teamspeak3_uid))
        Teamspeak3Manager.delete_user(authinfo.teamspeak3_uid)
        AuthServicesInfoManager.update_user_teamspeak3_info("", "", user)
        change = True
    if authinfo.discord_uid and authinfo.discord_uid != "":
        logger.debug("User %s has discord account %s. Deleting." % (user, authinfo.discord_uid))
        DiscordOAuthManager.delete_user(authinfo.discord_uid)
        AuthServicesInfoManager.update_user_discord_info("", user)
        change = True
    if authinfo.xenforo_username and authinfo.xenforo_password != "":
        logger.debug("User %s has a XenForo account %s. Deleting." % (user, authinfo.xenforo_username))
        XenForoManager.disable_user(authinfo.xenforo_username)
        AuthServicesInfoManager.update_user_xenforo_info("", user)
        change = True
    if authinfo.market_username and authinfo.market_username != "":
        logger.debug("User %s has a Market account %s. Deleting." % (user, authinfo.market_username))
        marketManager.disable_user(authinfo.market_username)
        AuthServicesInfoManager.update_user_market_info("", user)
        change = True
    if authinfo.discourse_enabled:
        logger.debug("User %s has a Discourse account. Disabling login." % user)
        DiscourseManager.disable_user(user)
        authinfo.discourse_enabled = False
        authinfo.save()
        change = True
    if authinfo.smf_username and authinfo.smf_username != "":
        logger.debug("User %s has a SMF account %s. Deleting." % (user, authinfo.smf_username))
        smfManager.disable_user(authinfo.smf_username)
        AuthServicesInfoManager.update_user_smf_info("", user)
        change = True
    if change:
        notify(user, "Services Disabled", message="Your services accounts have been disabled.", level="danger")
コード例 #7
0
ファイル: views.py プロジェクト: tankbusta/allianceauth
def deactivate_teamspeak3(request):
    authinfo = AuthServicesInfoManager.get_auth_service_info(request.user)
    result = Teamspeak3Manager.delete_user(authinfo.teamspeak3_uid)

    remove_all_syncgroups_for_service(request.user, "teamspeak3")

    # if false we failed
    if result:
        AuthServicesInfoManager.update_user_teamspeak3_info("", "", request.user)

        return HttpResponseRedirect("/services/")
    return HttpResponseRedirect("/")
コード例 #8
0
def deactivate_teamspeak3(request):
    logger.debug("deactivate_teamspeak3 called by user %s" % request.user)
    authinfo = AuthServicesInfoManager.get_auth_service_info(request.user)
    result = Teamspeak3Manager.delete_user(authinfo.teamspeak3_uid)

    # if false we failed
    if result:
        AuthServicesInfoManager.update_user_teamspeak3_info("", "", request.user)
        logger.info("Succesfully deactivated TS3 for user %s" % request.user)
        return HttpResponseRedirect("/services/")
    logger.error("Unsuccessful attempt to deactivate TS3 for user %s" % request.user)
    return HttpResponseRedirect("/")
コード例 #9
0
def deactivate_teamspeak3(request):
    authinfo = AuthServicesInfoManager.get_auth_service_info(request.user)
    result = Teamspeak3Manager.delete_user(authinfo.teamspeak3_uid)

    remove_all_syncgroups_for_service(request.user, "teamspeak3")

    # if false we failed
    if result:
        AuthServicesInfoManager.update_user_teamspeak3_info(
            "", "", request.user)

        return HttpResponseRedirect("/services/")
    return HttpResponseRedirect("/")
コード例 #10
0
ファイル: tasks.py プロジェクト: Adarnof/allianceauth
def validate_services(self, user, state):
    if state == MEMBER_STATE:
        setting_string = 'AUTH'
    elif state == BLUE_STATE:
        setting_string = 'BLUE'
    else:
        deactivate_services(user)
        return
    logger.debug('Ensuring user %s services are available to state %s' % (user, state))
    auth = AuthServicesInfo.objects.get_or_create(user=user)[0]
    if auth.mumble_username and not getattr(settings, 'ENABLE_%s_MUMBLE' % setting_string, False):
        MumbleManager.delete_user(auth.mumble_username)
        AuthServicesInfoManager.update_user_mumble_info("", user)
        notify(user, 'Mumble Account Disabled', level='danger')
    if auth.jabber_username and not getattr(settings, 'ENABLE_%s_JABBER' % setting_string, False):
        OpenfireManager.delete_user(auth.jabber_username)
        AuthServicesInfoManager.update_user_jabber_info("", user)
        notify(user, 'Jabber Account Disabled', level='danger')
    if auth.forum_username and not getattr(settings, 'ENABLE_%s_FORUM' % setting_string, False):
        Phpbb3Manager.disable_user(auth.forum_username)
        AuthServicesInfoManager.update_user_forum_info("", user)
        notify(user, 'Forum Account Disabled', level='danger')
    if auth.ipboard_username and not getattr(settings, 'ENABLE_%s_IPBOARD' % setting_string, False):
        IPBoardManager.disable_user(auth.ipboard_username)
        AuthServicesInfoManager.update_user_ipboard_info("", user)
        notify(user, 'IPBoard Account Disabled', level='danger')
    if auth.teamspeak3_uid and not getattr(settings, 'ENABLE_%s_TEAMSPEAK' % setting_string, False):
        Teamspeak3Manager.delete_user(auth.teamspeak3_uid)
        AuthServicesInfoManager.update_user_teamspeak3_info("", "", user)
        notify(user, 'TeamSpeak3 Account Disabled', level='danger')
    if auth.discord_uid and not getattr(settings, 'ENABLE_%s_DISCORD' % setting_string, False):
        DiscordOAuthManager.delete_user(auth.discord_uid)
        AuthServicesInfoManager.update_user_discord_info("", user)
        notify(user, 'Discord Account Disabled', level='danger')
    if auth.xenforo_username and not getattr(settings, 'ENABLE_%s_XENFORO' % setting_string, False):
        XenForoManager.disable_user(auth.xenforo_username)
        AuthServicesInfoManager.update_user_xenforo_info("", user)
        notify(user, 'XenForo Account Disabled', level='danger')
    if auth.market_username and not getattr(settings, 'ENABLE_%s_MARKET' % setting_string, False):
        marketManager.disable_user(auth.market_username)
        AuthServicesInfoManager.update_user_market_info("", user)
        notify(user, 'Alliance Market Account Disabled', level='danger')
    if auth.discourse_enabled and not getattr(settings, 'ENABLE_%s_DISCOURSE' % setting_string, False):
        DiscourseManager.disable_user(user)
        authinfo.discourse_enabled = False
        authinfo.save()
        notify(user, 'Discourse Account Disabled', level='danger')
    if auth.smf_username and not getattr(settings, 'ENABLE_%s_SMF' % setting_string, False):
        smfManager.disable_user(auth.smf_username)
        AuthServicesInfoManager.update_user_smf_info(auth.smf_username, user)
        notify(user, "SMF Account Disabled", level='danger')
コード例 #11
0
def validate_services(self, user, state):
    if state == MEMBER_STATE:
        setting_string = 'AUTH'
    elif state == BLUE_STATE:
        setting_string = 'BLUE'
    else:
        deactivate_services(user)
        return
    logger.debug('Ensuring user %s services are available to state %s' % (user, state))
    auth = AuthServicesInfo.objects.get_or_create(user=user)[0]
    if auth.mumble_username and not getattr(settings, 'ENABLE_%s_MUMBLE' % setting_string, False):
        MumbleManager.delete_user(auth.mumble_username)
        AuthServicesInfoManager.update_user_mumble_info("", user)
        notify(user, 'Mumble Account Disabled', level='danger')
    if auth.jabber_username and not getattr(settings, 'ENABLE_%s_JABBER' % setting_string, False):
        OpenfireManager.delete_user(auth.jabber_username)
        AuthServicesInfoManager.update_user_jabber_info("", user)
        notify(user, 'Jabber Account Disabled', level='danger')
    if auth.forum_username and not getattr(settings, 'ENABLE_%s_FORUM' % setting_string, False):
        Phpbb3Manager.disable_user(auth.forum_username)
        AuthServicesInfoManager.update_user_forum_info("", user)
        notify(user, 'Forum Account Disabled', level='danger')
    if auth.ipboard_username and not getattr(settings, 'ENABLE_%s_IPBOARD' % setting_string, False):
        IPBoardManager.disable_user(auth.ipboard_username)
        AuthServicesInfoManager.update_user_ipboard_info("", user)
        notify(user, 'IPBoard Account Disabled', level='danger')
    if auth.teamspeak3_uid and not getattr(settings, 'ENABLE_%s_TEAMSPEAK' % setting_string, False):
        Teamspeak3Manager.delete_user(auth.teamspeak3_uid)
        AuthServicesInfoManager.update_user_teamspeak3_info("", "", user)
        notify(user, 'TeamSpeak3 Account Disabled', level='danger')
    if auth.discord_uid and not getattr(settings, 'ENABLE_%s_DISCORD' % setting_string, False):
        DiscordOAuthManager.delete_user(auth.discord_uid)
        AuthServicesInfoManager.update_user_discord_info("", user)
        notify(user, 'Discord Account Disabled', level='danger')
    if auth.xenforo_username and not getattr(settings, 'ENABLE_%s_XENFORO' % setting_string, False):
        XenForoManager.disable_user(auth.xenforo_username)
        AuthServicesInfoManager.update_user_xenforo_info("", user)
        notify(user, 'XenForo Account Disabled', level='danger')
    if auth.market_username and not getattr(settings, 'ENABLE_%s_MARKET' % setting_string, False):
        marketManager.disable_user(auth.market_username)
        AuthServicesInfoManager.update_user_market_info("", user)
        notify(user, 'Alliance Market Account Disabled', level='danger')
    if auth.discourse_enabled and not getattr(settings, 'ENABLE_%s_DISCOURSE' % setting_string, False):
        DiscourseManager.disable_user(user)
        authinfo.discourse_enabled = False
        authinfo.save()
        notify(user, 'Discourse Account Disabled', level='danger')
    if auth.smf_username and not getattr(settings, 'ENABLE_%s_SMF' % setting_string, False):
        smfManager.disable_user(auth.smf_username)
        AuthServicesInfoManager.update_user_smf_info(auth.smf_username, user)
        notify(user, "SMF Account Disabled", level='danger')
コード例 #12
0
def deactivate_services(user):
    change = False
    logger.debug("Deactivating services for user %s" % user)
    authinfo = AuthServicesInfoManager.get_auth_service_info(user)
    if authinfo.mumble_username and authinfo.mumble_username != "":
        logger.debug("User %s has mumble account %s. Deleting." %
                     (user, authinfo.mumble_username))
        MumbleManager.delete_user(authinfo.mumble_username)
        AuthServicesInfoManager.update_user_mumble_info("", "", user)
        change = True
    if authinfo.jabber_username and authinfo.jabber_username != "":
        logger.debug("User %s has jabber account %s. Deleting." %
                     (user, authinfo.jabber_username))
        OpenfireManager.delete_user(authinfo.jabber_username)
        AuthServicesInfoManager.update_user_jabber_info("", "", user)
        change = True
    if authinfo.forum_username and authinfo.forum_username != "":
        logger.debug("User %s has forum account %s. Deleting." %
                     (user, authinfo.forum_username))
        Phpbb3Manager.disable_user(authinfo.forum_username)
        AuthServicesInfoManager.update_user_forum_info("", "", user)
        change = True
    if authinfo.ipboard_username and authinfo.ipboard_username != "":
        logger.debug("User %s has ipboard account %s. Deleting." %
                     (user, authinfo.ipboard_username))
        IPBoardManager.disable_user(authinfo.ipboard_username)
        AuthServicesInfoManager.update_user_forum_info("", "", user)
        change = True
    if authinfo.teamspeak3_uid and authinfo.teamspeak3_uid != "":
        logger.debug("User %s has mumble account %s. Deleting." %
                     (user, authinfo.teamspeak3_uid))
        Teamspeak3Manager.delete_user(authinfo.teamspeak3_uid)
        AuthServicesInfoManager.update_user_teamspeak3_info("", "", user)
        change = True
    if authinfo.discord_uid and authinfo.discord_uid != "":
        logger.debug("User %s has discord account %s. Deleting." %
                     (user, authinfo.discord_uid))
        DiscordOAuthManager.delete_user(authinfo.discord_uid)
        AuthServicesInfoManager.update_user_discord_info("", user)
        change = True
    if authinfo.xenforo_username and authinfo.xenforo_password != "":
        logger.debug("User %s has a XenForo account %s. Deleting." %
                     (user, authinfo.xenforo_username))
        XenForoManager.disable_user(authinfo.xenforo_username)
        AuthServicesInfoManager.update_user_xenforo_info("", "", user)
        change = True
    if change:
        notify(user,
               "Services Disabled",
               message="Your services accounts have been disabled.",
               level="danger")
コード例 #13
0
ファイル: views.py プロジェクト: tankbusta/allianceauth
def activate_teamspeak3(request):
    authinfo = AuthServicesInfoManager.get_auth_service_info(request.user)
    character = EveManager.get_character_by_id(authinfo.main_char_id)
    if check_if_user_has_permission(request.user, "blue_member"):
        result = Teamspeak3Manager.add_blue_user(character.character_name, character.corporation_ticker)
    else:
        result = Teamspeak3Manager.add_user(character.character_name, character.corporation_ticker)

    # if its empty we failed
    if result[0] is not "":
        AuthServicesInfoManager.update_user_teamspeak3_info(result[0], result[1], request.user)
        update_teamspeak3_groups(request.user)
        return HttpResponseRedirect("/services/")
    return HttpResponseRedirect("/dashboard")
コード例 #14
0
ファイル: common_task.py プロジェクト: icemanch/allianceauth
def deactivate_services(user):
    authinfo = AuthServicesInfoManager.get_auth_service_info(user)
    if authinfo.mumble_username and authinfo.mumble_username != "":
        MumbleManager.delete_user(authinfo.mumble_username)
        AuthServicesInfoManager.update_user_mumble_info("", "", user)
    if authinfo.jabber_username and authinfo.jabber_username != "":
        OpenfireManager.delete_user(authinfo.jabber_username)
        AuthServicesInfoManager.update_user_jabber_info("", "", user)
    if authinfo.forum_username and authinfo.forum_username != "":
        Phpbb3Manager.disable_user(authinfo.forum_username)
        AuthServicesInfoManager.update_user_forum_info("", "", user)
    if authinfo.ipboard_username and authinfo.ipboard_username != "":
        IPBoardManager.disable_user(authinfo.ipboard_username)
        AuthServicesInfoManager.update_user_forum_info("", "", user)
    if authinfo.teamspeak3_uid and authinfo.teamspeak3_uid != "":
        Teamspeak3Manager.delete_user(authinfo.teamspeak3_uid)
        AuthServicesInfoManager.update_user_teamspeak3_info("", "", user)
コード例 #15
0
def activate_teamspeak3(request):
    authinfo = AuthServicesInfoManager.get_auth_service_info(request.user)
    character = EveManager.get_character_by_id(authinfo.main_char_id)
    if check_if_user_has_permission(request.user, "blue_member"):
        result = Teamspeak3Manager.add_blue_user(character.character_name,
                                                 character.corporation_ticker)
    else:
        result = Teamspeak3Manager.add_user(character.character_name,
                                            character.corporation_ticker)

    # if its empty we failed
    if result[0] is not "":
        AuthServicesInfoManager.update_user_teamspeak3_info(
            result[0], result[1], request.user)
        update_teamspeak3_groups(request.user)
        return HttpResponseRedirect("/services/")
    return HttpResponseRedirect("/dashboard")
コード例 #16
0
ファイル: views.py プロジェクト: Nihoa/allianceauth
def activate_teamspeak3(request):
    logger.debug("activate_teamspeak3 called by user %s" % request.user)
    authinfo = AuthServicesInfoManager.get_auth_service_info(request.user)
    character = EveManager.get_character_by_id(authinfo.main_char_id)
    if check_if_user_has_permission(request.user, "blue_member"):
        logger.debug("Adding TS3 user for blue user %s with main character %s" % (request.user, character))
        result = Teamspeak3Manager.add_blue_user(character.character_name, character.corporation_ticker)
    else:
        logger.debug("Adding TS3 user for user %s with main character %s" % (request.user, character))
        result = Teamspeak3Manager.add_user(character.character_name, character.corporation_ticker)

    # if its empty we failed
    if result[0] is not "":
        AuthServicesInfoManager.update_user_teamspeak3_info(result[0], result[1], request.user)
        logger.debug("Updated authserviceinfo for user %s with TS3 credentials. Updating groups." % request.user)
        logger.info("Succesfully activated TS3 for user %s" % request.user)
        return HttpResponseRedirect("/verify_teamspeak3/")
    logger.error("Unsuccessful attempt to activate TS3 for user %s" % request.user)
    return HttpResponseRedirect("/dashboard")
コード例 #17
0
ファイル: common_task.py プロジェクト: Geabo/allianceauth
def deactivate_services(user):
    change = False
    logger.debug("Deactivating services for user %s" % user)
    authinfo = AuthServicesInfoManager.get_auth_service_info(user)
    if authinfo.mumble_username and authinfo.mumble_username != "":
        logger.debug("User %s has mumble account %s. Deleting." % (user, authinfo.mumble_username))
        MumbleManager.delete_user(authinfo.mumble_username)
        AuthServicesInfoManager.update_user_mumble_info("", "", user)
        change = True
    if authinfo.jabber_username and authinfo.jabber_username != "":
        logger.debug("User %s has jabber account %s. Deleting." % (user, authinfo.jabber_username))
        OpenfireManager.delete_user(authinfo.jabber_username)
        AuthServicesInfoManager.update_user_jabber_info("", "", user)
        change = True
    if authinfo.forum_username and authinfo.forum_username != "":
        logger.debug("User %s has forum account %s. Deleting." % (user, authinfo.forum_username))
        Phpbb3Manager.disable_user(authinfo.forum_username)
        AuthServicesInfoManager.update_user_forum_info("", "", user)
        change = True
    if authinfo.ipboard_username and authinfo.ipboard_username != "":
        logger.debug("User %s has ipboard account %s. Deleting." % (user, authinfo.ipboard_username))
        IPBoardManager.disable_user(authinfo.ipboard_username)
        AuthServicesInfoManager.update_user_forum_info("", "", user)
        change = True
    if authinfo.teamspeak3_uid and authinfo.teamspeak3_uid != "":
        logger.debug("User %s has mumble account %s. Deleting." % (user, authinfo.teamspeak3_uid))
        Teamspeak3Manager.delete_user(authinfo.teamspeak3_uid)
        AuthServicesInfoManager.update_user_teamspeak3_info("", "", user)
        change = True
    if authinfo.discord_uid and authinfo.discord_uid != "":
        logger.debug("User %s has discord account %s. Deleting." % (user, authinfo.discord_uid))
        DiscordOAuthManager.delete_user(authinfo.discord_uid)
        AuthServicesInfoManager.update_user_discord_info("", user)
        change = True
    if authinfo.xenforo_username and authinfo.xenforo_password != "":
        logger.debug("User %s has a XenForo account %s. Deleting." % (user, authinfo.xenforo_username))
        XenForoManager.disable_user(authinfo.xenforo_username)
        AuthServicesInfoManager.update_user_xenforo_info("", "", user)
        change = True
    if change:
        notify(user, "Services Disabled", message="Your services accounts have been disabled.", level="danger")
コード例 #18
0
ファイル: views.py プロジェクト: tankbusta/allianceauth
def reset_teamspeak3_perm(request):
    authinfo = AuthServicesInfoManager.get_auth_service_info(request.user)
    character = EveManager.get_character_by_id(authinfo.main_char_id)

    Teamspeak3Manager.delete_user(authinfo.teamspeak3_uid)

    remove_all_syncgroups_for_service(request.user, "teamspeak3")

    if check_if_user_has_permission(request.user, "blue_member"):
        result = Teamspeak3Manager.generate_new_blue_permissionkey(authinfo.teamspeak3_uid, character.character_name,
                                                                   character.corporation_ticker)
    else:
        result = Teamspeak3Manager.generate_new_permissionkey(authinfo.teamspeak3_uid, character.character_name,
                                                              character.corporation_ticker)

    # if blank we failed
    if result != "":
        AuthServicesInfoManager.update_user_teamspeak3_info(result[0], result[1], request.user)
        update_teamspeak3_groups(request.user)
        return HttpResponseRedirect("/services/")
    return HttpResponseRedirect("/")
コード例 #19
0
def reset_teamspeak3_perm(request):
    authinfo = AuthServicesInfoManager.get_auth_service_info(request.user)
    character = EveManager.get_character_by_id(authinfo.main_char_id)

    Teamspeak3Manager.delete_user(authinfo.teamspeak3_uid)

    remove_all_syncgroups_for_service(request.user, "teamspeak3")

    if check_if_user_has_permission(request.user, "blue_member"):
        result = Teamspeak3Manager.generate_new_blue_permissionkey(
            authinfo.teamspeak3_uid, character.character_name,
            character.corporation_ticker)
    else:
        result = Teamspeak3Manager.generate_new_permissionkey(
            authinfo.teamspeak3_uid, character.character_name,
            character.corporation_ticker)

    # if blank we failed
    if result != "":
        AuthServicesInfoManager.update_user_teamspeak3_info(
            result[0], result[1], request.user)
        update_teamspeak3_groups(request.user)
        return HttpResponseRedirect("/services/")
    return HttpResponseRedirect("/")