From 2ba56128acd97f4df4592fd78e64790d3390ea72 Mon Sep 17 00:00:00 2001 From: kakwa Date: Mon, 18 May 2015 20:04:47 +0200 Subject: [PATCH] adding loading roles and attributes --- ldapcherry/__init__.py | 8 ++++++++ tests/cfg/ldapcherry.ini | 8 ++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/ldapcherry/__init__.py b/ldapcherry/__init__.py index 40dfb64..e38ee2d 100644 --- a/ldapcherry/__init__.py +++ b/ldapcherry/__init__.py @@ -16,6 +16,8 @@ from operator import itemgetter from socket import error as socket_error from exceptions import * +from ldapcherry.roles import Roles +from ldapcherry.attributes import Attributes #cherrypy http framework imports import cherrypy @@ -165,6 +167,12 @@ class LdapCherry(object): #auth = __import__(auth_module, globals(), locals(), ['Auth'], -1) #self.auth = auth.Auth(config['auth'], cherrypy.log) + self.roles_file = self._get_param('roles', 'roles.file', config) + self.roles = Roles(self.roles_file) + + self.attributes_file = self._get_param('attributes', 'attributes.file', config) + self.roles = Attributes(self.attributes_file) + except Exception as e: self._handle_exception(e) exit(1) diff --git a/tests/cfg/ldapcherry.ini b/tests/cfg/ldapcherry.ini index f70081c..81533a6 100644 --- a/tests/cfg/ldapcherry.ini +++ b/tests/cfg/ldapcherry.ini @@ -57,12 +57,12 @@ tools.sessions.timeout = 10 [attributes] # file discribing form content -attributes.file = '/etc/ldapcherry/attributes.yml' +attributes.file = './tests/cfg/attributes.yml' [roles] # file listing roles -roles.file = '/etc/ldapcherry/roles.yml' +roles.file = './tests/cfg/roles.yml' [backends] @@ -96,8 +96,8 @@ auth.mode = 'or' # resources parameters [resources] # templates directory -templates.dir = '/usr/share/ldapcherry/templates/' +templates.dir = './resources/templates/' [/static] tools.staticdir.on = True -tools.staticdir.dir = '/usr/share/ldapcherry/static/' +tools.staticdir.dir = './resources/static/'