Beispiel #1
0
def update_discourse_groups(self, pk):
    user = User.objects.get(pk=pk)
    logger.debug("Updating discourse groups for user %s" % user)
    try:
        DiscourseManager.update_groups(user)
    except:
        logger.warn("Discourse group sync failed for %s, retrying in 10 mins" % user)
        raise self.retry(countdown=60 * 10)
    logger.debug("Updated user %s discourse groups." % user)
Beispiel #2
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")
Beispiel #3
0
def update_discourse_groups(self, pk):
    user = User.objects.get(pk=pk)
    logger.debug("Updating discourse groups for user %s" % user)
    try:
        DiscourseManager.update_groups(user)
    except:
        logger.warn("Discourse group sync failed for %s, retrying in 10 mins" % user)
        raise self.retry(countdown=60 * 10)
    logger.debug("Updated user %s discourse groups." % user)
Beispiel #4
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")
Beispiel #5
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')
Beispiel #6
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')
Beispiel #7
0
def update_discourse_groups(pk):
    user = User.objects.get(pk=pk)
    logger.debug("Updating discourse groups for user %s" % user)
    authserviceinfo = AuthServicesInfo.objects.get(user=user)
    groups = []
    for group in user.groups.all():
        groups.append(str(group.name))
    if len(groups) == 0:
        logger.debug("No syncgroups found for user. Adding empty group.")
        groups.append('empty')
    logger.debug("Updating user %s discord groups to %s" % (user, groups))
    try:
        DiscourseManager.update_groups(authserviceinfo.discourse_username, groups)
    except:
        logger.warn("Discourse group sync failed for %s, retrying in 10 mins" % user, exc_info=True)
        raise self.retry(countdown = 60 * 10)
    logger.debug("Updated user %s discord groups." % user)
Beispiel #8
0
def update_discourse_groups(pk):
    user = User.objects.get(pk=pk)
    logger.debug("Updating discourse groups for user %s" % user)
    authserviceinfo = AuthServicesInfo.objects.get(user=user)
    groups = []
    for group in user.groups.all():
        groups.append(str(group.name))
    if len(groups) == 0:
        logger.debug("No syncgroups found for user. Adding empty group.")
        groups.append('empty')
    logger.debug("Updating user %s discourse groups to %s" % (user, groups))
    try:
        DiscourseManager.update_groups(authserviceinfo.discourse_username, groups)
    except:
        logger.warn("Discourse group sync failed for %s, retrying in 10 mins" % user, exc_info=True)
        raise self.retry(countdown = 60 * 10)
    logger.debug("Updated user %s discourse groups." % user)