From 8d284b151d79daa892656a20c668953409659f85 Mon Sep 17 00:00:00 2001 From: Krakinou Date: Sat, 12 Jan 2019 12:52:27 +0100 Subject: [PATCH] Edit html config --- cps/templates/config_edit.html | 15 +++++++++++++++ cps/ub.py | 15 ++++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/cps/templates/config_edit.html b/cps/templates/config_edit.html index b2826b39..c12d3a9f 100644 --- a/cps/templates/config_edit.html +++ b/cps/templates/config_edit.html @@ -162,6 +162,21 @@ {% endif %} +
+ + +
+
+
+ + +
+
+ + +
+
+ diff --git a/cps/ub.py b/cps/ub.py index 14cf0b24..325b5132 100644 --- a/cps/ub.py +++ b/cps/ub.py @@ -320,6 +320,9 @@ class Settings(Base): config_use_goodreads = Column(Boolean) config_goodreads_api_key = Column(String) config_goodreads_api_secret = Column(String) + config_use_ldap = Column(Boolean) + config_ldap_provider_url = Column(String) + config_ldap_dn = Column(String) config_mature_content_tags = Column(String) config_logfile = Column(String) config_ebookconverter = Column(Integer, default=0) @@ -392,6 +395,9 @@ class Config: self.config_use_goodreads = data.config_use_goodreads self.config_goodreads_api_key = data.config_goodreads_api_key self.config_goodreads_api_secret = data.config_goodreads_api_secret + self.config_use_ldap = data.config_use_ldap + self.config_ldap_provider_url = data.config_ldap_provider_url + self.config_ldap_dn = data.config_ldap_dn if data.config_mature_content_tags: self.config_mature_content_tags = data.config_mature_content_tags else: @@ -678,7 +684,14 @@ def migrate_Database(): conn.execute("ALTER TABLE Settings ADD column `config_converterpath` String DEFAULT ''") conn.execute("ALTER TABLE Settings ADD column `config_calibre` String DEFAULT ''") session.commit() - + try: + session.query(exists().where(Settings.config_use_ldap)).scalar() + except exc.OperationalError: + conn = engine.connect() + conn.execute("ALTER TABLE Settings ADD column `config_use_ldap` INTEGER DEFAULT 0") + conn.execute("ALTER TABLE Settings ADD column `config_ldap_provider_url` String DEFAULT ''") + conn.execute("ALTER TABLE Settings ADD column `config_ldap_dn` String DEFAULT ''") + session.commit() # Remove login capability of user Guest conn = engine.connect() conn.execute("UPDATE user SET password='' where nickname = 'Guest' and password !=''")