From 7a8e616f1731f4bf4d78d140ec5b08f0f733ad27 Mon Sep 17 00:00:00 2001 From: BaiJiangJie <32935519+BaiJiangJie@users.noreply.github.com> Date: Wed, 19 Jun 2019 16:47:39 +0800 Subject: [PATCH] =?UTF-8?q?[Update]=20=E6=B7=BB=E5=8A=A0=E4=B8=80=E9=94=AE?= =?UTF-8?q?=E7=A6=81=E7=94=A8LDAP=E8=AE=A4=E8=AF=81=E8=84=9A=E6=9C=AC=20(#?= =?UTF-8?q?2813)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils/disable_ldap_auth.sh | 22 +++++++++++++++++++ ...isable_user_mfa.py => disable_user_mfa.sh} | 0 2 files changed, 22 insertions(+) create mode 100644 utils/disable_ldap_auth.sh rename utils/{disable_user_mfa.py => disable_user_mfa.sh} (100%) diff --git a/utils/disable_ldap_auth.sh b/utils/disable_ldap_auth.sh new file mode 100644 index 000000000..2827238c2 --- /dev/null +++ b/utils/disable_ldap_auth.sh @@ -0,0 +1,22 @@ +#!/bin/bash +# + +function disable_auth_ldap() { +python3 ../apps/manage.py shell << EOF +import sys +from settings.models import Setting +auth_ldap = Setting.objects.get(name='AUTH_LDAP') +if not auth_ldap: + print("No AUTH_LDAP config") + sys.exit(1) +if auth_ldap.value == 'false': + print("AUTH_LDAP is already disabled") + sys.exit(1) +auth_ldap.value = 'false' +auth_ldap.save() +auth_ldap.refresh_setting() +print("Disable AUTH_LDAP success!") +EOF +} + +disable_auth_ldap diff --git a/utils/disable_user_mfa.py b/utils/disable_user_mfa.sh similarity index 100% rename from utils/disable_user_mfa.py rename to utils/disable_user_mfa.sh