Ejemplo n.º 1
0
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)
Ejemplo n.º 2
0
def update_discord_groups(user):
    syncgroups = SyncGroupCache.objects.filter(user=user)
    authserviceinfo = AuthServicesInfo.objects.get(user=user)
    groups = []
    for syncgroup in syncgroups:
        groups.append(str(syncgroup.groupname))

    if len(groups) == 0:
        groups.append('empty')

    DiscordManager.update_groups(authserviceinfo.discord_uid, groups)
Ejemplo n.º 3
0
def update_discord_groups(user):
    logger.debug("Updating discord groups for user %s" % user)
    syncgroups = SyncGroupCache.objects.filter(user=user)
    authserviceinfo = AuthServicesInfo.objects.get(user=user)
    groups = []
    for syncgroup in syncgroups:
        groups.append(str(syncgroup.groupname))

    logger.debug("User %s has %s syncgroups." % (user, len(syncgroups)))
    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))
    DiscordManager.update_groups(authserviceinfo.discord_uid, groups)
    logger.info("Updated user %s discord groups." % user)
Ejemplo n.º 4
0
def update_discord_groups(pk):
    user = User.objects.get(pk=pk)
    logger.debug("Updating discord 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:
        DiscordManager.update_groups(authserviceinfo.discord_uid, groups)
    except:
        logger.exception("Discord group sync failed for %s, retrying in 10 mins" % user)
        raise self.retry(countdown = 60 * 10)
    logger.debug("Updated user %s discord groups." % user)
Ejemplo n.º 5
0
def update_discord_groups(pk):
    user = User.objects.get(pk=pk)
    logger.debug("Updating discord 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:
        DiscordManager.update_groups(authserviceinfo.discord_uid, groups)
    except:
        logger.exception("Discord group sync failed for %s, retrying in 10 mins" % user)
        raise self.retry(countdown = 60 * 10)
    logger.debug("Updated user %s discord groups." % user)
Ejemplo n.º 6
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))
        DiscordManager.delete_user(authinfo.discord_uid)
        AuthServicesInfoManager.update_user_discord_info("", user)
        change = True
    if change:
        notify(user,
               "Services Disabled",
               message="Your services accounts have been disabled.",
               level="danger")
Ejemplo n.º 7
0
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)
    if authinfo.discord_uid and authinfo.discord_uid != "":
        DiscordManager.delete_user(authinfo.discord_uid)
        AuthServicesInfoManager.update_user_discord_info("", user)
Ejemplo n.º 8
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))
        DiscordManager.delete_user(authinfo.discord_uid)
        AuthServicesInfoManager.update_user_discord_info("", user)
        change = True
    if change:
        notify(user, "Services Disabled", message="Your services accounts have been disabled.", level="danger")