seitime-frappe/frappe/patches/v7_2/setup_ldap_config.py
Aditya Hase 837bfc0995 fix(unicode): Import unicode_literals in every file (#6805)
* fix(unicode): Import unicode_literals in every file

* fix(unicode): Test if safe_json_loads return unicode instead of bytes
2019-01-25 11:56:27 +05:30

22 lines
534 B
Python

from __future__ import unicode_literals
import frappe
from frappe.utils import cint
def execute():
frappe.reload_doc("integrations", "doctype", "ldap_settings")
if not frappe.db.exists("DocType", "Integration Service"):
return
if not frappe.db.exists("Integration Service", "LDAP"):
return
if not cint(frappe.db.get_value("Integration Service", "LDAP", 'enabled')):
return
import ldap
try:
ldap_settings = frappe.get_doc("LDAP Settings")
ldap_settings.save(ignore_permissions=True)
except ldap.LDAPError:
pass