summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--account.py4
-rw-r--r--app.py4
-rwxr-xr-x[-rw-r--r--]contrib/munin/accounts.py16
-rw-r--r--default_settings.py5
4 files changed, 18 insertions, 11 deletions
diff --git a/account.py b/account.py
index f25e170..bd837d9 100644
--- a/account.py
+++ b/account.py
@@ -4,10 +4,6 @@ from utils import Service
from uuid import uuid4
-LDAP_HOST = 'ldap://localhost:5678'
-LDAP_BASE_DN = [('dc','account'),('dc','spline'),('dc','inf'),('dc','fu-berlin'),('dc','de')]
-LDAP_ADMIN_USER = 'admin'
-LDAP_ADMIN_PASS = 'admin'
SERVICES = [
Service('foren', 'Foren', 'http://foren.spline.de/'),
Service('jabber', 'Jabber', 'http://jabber.spline.de/'),
diff --git a/app.py b/app.py
index 4a3a962..4c93ccf 100644
--- a/app.py
+++ b/app.py
@@ -20,8 +20,8 @@ app.all_services = account.SERVICES #TODO: take that from our json file or so
@app.before_request
def ldap_connect():
- g.ldap = account.AccountService(account.LDAP_HOST, account.LDAP_BASE_DN,
- account.LDAP_ADMIN_USER, account.LDAP_ADMIN_PASS, app.all_services)
+ g.ldap = account.AccountService(app.config['LDAP_HOST'], app.config['LDAP_BASE_DN'],
+ app.config['LDAP_ADMIN_USER'], app.config['LDAP_ADMIN_PASS'], app.all_services)
g.user = None
diff --git a/contrib/munin/accounts.py b/contrib/munin/accounts.py
index 947989b..684f278 100644..100755
--- a/contrib/munin/accounts.py
+++ b/contrib/munin/accounts.py
@@ -1,17 +1,23 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
import sys
from os.path import dirname, abspath
sys.path.append(dirname(dirname(dirname(abspath(__file__)))))
-from account import *
+from account import AccountService
+from app import app
if __name__ == "__main__":
if len(sys.argv) > 1 and sys.argv[1] == 'config':
- print('graph_title Splinux')
- print('graph_vlabel Amount')
+ print('graph_title Spline Accounts')
+ print('graph_vlabel Number')
print('accounts.label Accounts')
else:
- service = AccountService(LDAP_HOST, LDAP_BASE_DN, SERVICES, LDAP_ADMIN_USER, LDAP_ADMIN_PASS)
+ service = AccountService(app.config['LDAP_HOST'], app.config['LDAP_BASE_DN'],
+ app.config['LDAP_ADMIN_USER'], app.config['LDAP_ADMIN_PASS'],
+ app.all_services)
+
accounts = service.find()
- print('accounts.value %s' % len(accounts))
+ print('accounts.value %d' % len(accounts))
diff --git a/default_settings.py b/default_settings.py
index 6fc80c3..002cc0c 100644
--- a/default_settings.py
+++ b/default_settings.py
@@ -7,3 +7,8 @@ MAIL_DEFAULT_SENDER = 'help-me-help-me-please@spline.de'
MAIL_CONFIRM_SENDER = 'spline accounts <noreply@account.spline.de>'
SENDMAIL_COMMAND = '/usr/sbin/sendmail'
+
+LDAP_HOST = 'ldap://localhost:5678'
+LDAP_BASE_DN = [('dc','account'),('dc','spline'),('dc','inf'),('dc','fu-berlin'),('dc','de')]
+LDAP_ADMIN_USER = 'admin'
+LDAP_ADMIN_PASS = 'admin'