[X2Go-Commits] x2gobroker.git - tmp (branch) updated: c7f83b8f318d56775110908c8c4afef1f8bef6e9

X2Go dev team git-admin at x2go.org
Tue Apr 23 21:08:37 CEST 2013


The branch, tmp has been updated
       via  c7f83b8f318d56775110908c8c4afef1f8bef6e9 (commit)
      from  689eb8340b47a1188a1b628d244e001054a5ac35 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
-----------------------------------------------------------------------

Summary of changes:
 x2gobroker/backends/__init__.py                    |   20 -
 x2gobroker/backends/base.py                        |  564 --------------------
 x2gobroker/backends/inifile.py                     |   90 ----
 x2gobroker/backends/ldap.py                        |   33 --
 x2gobroker/backends/zeroconf.py                    |   84 ---
 .../{test_backend_base.py => test_broker_base.py}  |   26 +-
 ...t_backend_inifile.py => test_broker_inifile.py} |   12 +-
 ...backend_zeroconf.py => test_broker_zeroconf.py} |    6 +-
 x2gobroker/tests/test_web_plain_base.py            |    2 +-
 x2gobroker/tests/test_web_plain_zeroconf.py        |    2 +-
 x2gobroker/web/html.py                             |    4 +-
 x2gobroker/web/plain.py                            |    4 +-
 12 files changed, 28 insertions(+), 819 deletions(-)
 delete mode 100644 x2gobroker/backends/__init__.py
 delete mode 100644 x2gobroker/backends/base.py
 delete mode 100644 x2gobroker/backends/inifile.py
 delete mode 100644 x2gobroker/backends/ldap.py
 delete mode 100644 x2gobroker/backends/zeroconf.py
 rename x2gobroker/tests/{test_backend_base.py => test_broker_base.py} (90%)
 rename x2gobroker/tests/{test_backend_inifile.py => test_broker_inifile.py} (93%)
 rename x2gobroker/tests/{test_backend_zeroconf.py => test_broker_zeroconf.py} (94%)

The diff of changes is:
diff --git a/x2gobroker/backends/__init__.py b/x2gobroker/backends/__init__.py
deleted file mode 100644
index 11b7f8f..0000000
--- a/x2gobroker/backends/__init__.py
+++ /dev/null
@@ -1,20 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# Copyright (C) 2012 by Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
-# Copyright (C) 2012 by Oleksandr Shneyder <oleksandr.shneyder at obviously-nice.de>
-#
-# X2Go Session Broker is free software; you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# X2Go Session Broker is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program; if not, write to the
-# Free Software Foundation, Inc.,
-# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
-
diff --git a/x2gobroker/backends/base.py b/x2gobroker/backends/base.py
deleted file mode 100644
index fb27617..0000000
--- a/x2gobroker/backends/base.py
+++ /dev/null
@@ -1,564 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# Copyright (C) 2012 by Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
-# Copyright (C) 2012 by Oleksandr Shneyder <oleksandr.shneyder at obviously-nice.de>
-#
-# X2Go Session Broker is free software; you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# X2Go Session Broker is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program; if not, write to the
-# Free Software Foundation, Inc.,
-# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
-
-"""\
-X2goBrokerBASE class - base skeleton for X2GoBroker implementations
-
-"""
-__NAME__ = 'x2gobroker-pylib'
-
-# modules
-import types
-import copy
-import uuid
-import pam
-
-# X2Go Broker modules
-import x2gobroker.config
-import x2gobroker.defaults
-
-class X2GoBroker(object):
-    """\
-    L{base.X2GoBroker} is an abstract class for X2Go broker implementations.
-
-    This class needs to be inherited from a concrete broker class.
-
-    Currently available broker classes are::
-        L{zeroconf.X2GoBroker} (working)
-        L{inifile.X2GoBroker} (in prep)
-        L{ldap.X2GoBroker} (in prep)
-
-    """
-
-    backend_name = 'base'
-    nameservice_module = None
-    authmech_module = None
-
-    def __init__(self, config_file=None, config_defaults=None):
-        """\
-        Initialize a new X2GoBroker instance to control X2Go session through an
-        X2Go Client with an intermediate session broker.
-
-        """
-        if config_file is None: config_file = x2gobroker.defaults.X2GOBROKER_CONFIG
-        if config_defaults is None: config_defaults = x2gobroker.defaults.X2GOBROKER_CONFIG_DEFAULTS
-        self.config = x2gobroker.config.X2GoBrokerConfigFile(config_files=config_file, defaults=config_defaults)
-
-        self._dynamic_authid_map = {}
-
-    def __del__(self):
-        """\
-        Cleanup on destruction of an L{X2GoBroker} instance.
-
-        """
-        pass
-
-    def is_enabled(self):
-        """\
-        Check if this backend has been enabled in the configuration file.
-
-        """
-        return self.config.get_value(self.backend_name, 'enable')
-
-    def get_global_config(self):
-        """\
-        Get the global section of the configuration file.
-
-        @return: all global configuration parameters
-        @rtype: C{dict}
-
-        """
-        return self.config.get_section('global')
-
-    def get_backend_config(self):
-        """\
-        Get the configuration section of a specific backend.
-
-        @return: all backend configuration parameters
-        @rtype: C{dict}
-
-        """
-        return self.config.get_section(self.backend_name)
-
-    def get_backend_value(self, backend='zeroconf', option='enabled'):
-        """\
-        Get the configuration setting for backend C{backend} and option
-        C{option}.
-
-        @param backend: the name of the backend
-        @type backend: C{str}
-        @param option: option name of the backend's configuration section
-        @type option: C{str}
-
-        @return: the value for the given C{backend} C{option}
-        @rtype: C{dict}
-
-        """
-        return self.config.get_value(backend, option)
-
-    def get_profile_ids(self):
-        """\
-        Retrieve the complete list of session profile IDs.
-
-        @return: list of profile IDs
-        @rtype: C{list}
-
-        """
-        return []
-
-    def get_profile_defaults(self):
-        """\
-        Get the session profile defaults, i.e. profile options that all
-        configured session profiles have in common.
-
-        The defaults are hard-coded in L{x2gobroker.defaults} for class
-        L{x2gobroker.base.X2GoBroker}.
-
-        @return: a dictionary containing the session profile defaults
-        @rtype: C{dict}
-
-        """
-        profile_defaults = copy.deepcopy(x2gobroker.defaults.X2GOBROKER_SESSIONPROFILE_DEFAULTS['DEFAULT'])
-        for key in copy.deepcopy(profile_defaults):
-            if key.startswith('acl-'):
-                del profile_defaults[key]
-        return profile_defaults
-
-    def get_acl_defaults(self):
-        """\
-        Get the ACL defaults for session profiles. The defaults are hard-coded
-        in L{x2gobroker.defaults} for class L{x2gobroker.base.X2GoBroker}.
-
-        @return: a dictionary containing the ACL defaults for all session profiles
-        @rtype: C{dict}
-
-        """
-        acl_defaults = copy.deepcopy(x2gobroker.defaults.X2GOBROKER_SESSIONPROFILE_DEFAULTS['DEFAULT'])
-        for key in copy.deepcopy(acl_defaults):
-            if not key.startswith('acl-'):
-                del acl_defaults[key]
-        return acl_defaults
-
-    def get_profile(self, profile_id):
-        """\
-        Get the session profile for profile ID <profile_id>.
-
-        @param profile_id: the ID of a profile, in other words the section name in the configuration file
-        @type profile_id: C{unicode}
-
-        @return: a dictionary representing the session profile for ID <profile_id>
-        @rtype: C{dict}
-
-        """
-        return {}
-
-    def get_profile_acls(self, profile_id):
-        """\
-        Get the ACLs for session profile with profile ID <profile_id>.
-
-        @param profile_id: the ID of a profile, in other words the section name in the configuration file
-        @type profile_id: C{unicode}
-
-        @return: a dictionary representing the ACLs for session profile with ID <profile_id>
-        @rtype: C{dict}
-
-        """
-        return {}
-
-    def check_profile_acls(self, username, acls):
-        """\
-        Test if a given user can get through an ACL check using <acls> as a list
-        of allow and deny rules.
-
-        @param username: the username of interest
-        @type username: C{unicode}
-        @param acls: a dictionary data structure containing ACL information (see L{defaults.X2GOBROKER_SESSIONPROFILE_DEFAULTS})
-        @type acls: C{dict}
-
-        """
-        ### extract ACLs evaluation orders
-
-        _acls = self.get_acl_defaults()
-        _acls.update(acls)
-
-        _order = {}
-        _order['users'] = _order['groups'] = _order['clients'] = _acls['acl-any-order']
-
-        try: _order['users'] = _acls['acl-users-order']
-        except KeyError: pass
-        try: _order['groups'] = _acls['acl-groups-order']
-        except KeyError: pass
-        try: _order['clients'] = _acls['acl-clients-order']
-        except KeyError: pass
-
-        # to pass an ACL test, all three keys in the dict below have to be set to True
-        # if one stays False, the related session profile will not be returned to the querying
-        # X2Go client...
-        _grant_availability = {
-            'by_user': False,
-            # FIXME: leaving the group access to False for now, we need methods that give us a generic
-            # acces to the list of groups a user belongs to. One generic access is asking libnss, but:
-            # are there others?
-            'by_group': False,
-            # FIXME: set the client access to True for now as we have not a way to check that available...
-            'by_client': True,
-        }
-
-        ### CHECKING on a per-user basis...
-
-        _allow_user = False
-        _deny_user = False
-        _explicit_deny_user = False
-
-        if (username in _acls['acl-users-allow']) or ('ALL' in _acls['acl-users-allow']):
-            _allow_user = True
-
-        if username in _acls['acl-users-deny']:
-            _explicit_deny_user = True
-        if _explicit_deny_user or ('ALL' in _acls['acl-users-deny']):
-            _deny_user = True
-
-        if _order['users'] == 'allow-deny':
-            _grant_availability['by_user'] = _allow_user and not _deny_user
-        else:
-            _grant_availability['by_user'] = not _deny_user or _allow_user
-
-        ### CHECKING on a per-group basis...
-
-        # FIXME: todo
-
-        ### CHECKING on a per-client basis...
-
-        # FIXME: todo
-
-        ### clients access is granted first, if that fails then we return False here...
-
-        if not _grant_availability['by_client']:
-            return False
-
-        ### now let's deal out the several combinations of user and group ACLs...
-        ###
-
-        # if a user has been granted access directly, then the corresponding session profile
-        # will be provided to him/her.
-        if _grant_availability['by_user']:
-            return True
-
-        # if a group has been granted access, with one exception: if the thread model for users is
-        # allow-deny, then we presume that the acl-users-deny entry has precendence over
-        # acl-groups-allow/acl-groups-deny.
-        if _grant_availability['by_group'] and not _explicit_deny_user:
-            return True
-
-        return False
-
-    def test_connection(self):
-        #if($cgi->param('task') eq 'testcon')
-        #{
-        #   for ( my $i=0;$i<2*1024*1024;$i++ )
-        #   {
-        #           print int(rand(9));
-        #   }
-        #   print $cgi->end_html();
-        #   exit (0);
-        #}
-        return 'OK'
-
-    def _import_authmech_module(self, mech='pam'):
-        try:
-            if self.authmech_module is None:
-                exec("import x2gobroker.authmechs.{mech} as _authmech_module".format(mech=mech))
-                self.authmech_module = _authmech_module
-            return True
-        except ImportError:
-            return False
-
-    def _do_authenticate(self, username='', password=''):
-
-        if self._import_authmech_module(mech=self.get_authentication_mechanism()):
-            return self.authmech_module.X2GoBrokerAuthMech().authenticate(username, password)
-        else:
-            return False
-
-    def get_authentication_mechanism(self):
-        """\
-        Get the name of the authentication mechanism that is configured for this
-        X2Go Session Broker instance.
-
-        @return: auth-mech name
-        @rtype: C{unicode}
-
-        """
-        _default_auth_mech = "pam"
-        _auth_mech = ""
-        if self.config.has_value('global', 'default-auth-mech'):
-            _default_auth_mech = self.config.get_value('global', 'default-auth-mech').lower()
-
-        if self.config.has_value(self.backend_name, 'auth-mech'):
-            _auth_mech = self.config.get_value(self.backend_name, 'auth-mech').lower()
-
-        return unicode(_auth_mech) or unicode(_default_auth_mech)
-
-    def get_userdb_service(self):
-        """\
-        Get the name of the backend being used for retrieving user information from the
-        system.
-
-        @return: user service name
-        @rtype: C{unicode}
-
-        """
-        _user_db = "libnss"
-        if self.config.has_value('global', 'default-user-db'):
-            _user_db = self.config.get_value('global', 'default-user-db').lower()
-
-        if self.config.has_value(self.backend_name, 'user-db'):
-            _user_db = self.config.get_value(self.backend_name, 'user-db').lower()
-
-        return unicode(_user_db)
-
-    def get_groupdb_service(self):
-        """\
-        Get the name of the backend being used for retrieving group information from the
-        system.
-
-        @return: group service name
-        @rtype: C{unicode}
-
-        """
-        _group_db = "libnss"
-        if self.config.has_value('global', 'default-group-db'):
-            _group_db = self.config.get_value('global', 'default-group-db').lower()
-
-        if self.config.has_value(self.backend_name, 'group-db'):
-            _group_db = self.config.get_value(self.backend_name, 'group-db').lower()
-
-        return unicode(_group_db)
-
-    def _import_nameservice_module(self, service='libnss'):
-        try:
-            if self.nameservice_module is None:
-                exec("import x2gobroker.nameservices.{service} as _nameservice_module".format(service=service))
-                self.nameservice_module = _nameservice_module
-            return True
-        except ImportError:
-            return False
-
-    def has_user(self, username):
-        """\
-        Test if the broker knows user C{<username>}.
-
-        @param username: test for existence of this user
-        @type username: C{unicode}
-
-        @return: returns C{True} if a user exists
-        @rtype: C{bool}
-
-        """
-        if self._import_nameservice_module(service=self.get_userdb_service()):
-            return self.nameservice_module.X2GoBrokerNameService().has_user(username=username)
-        else:
-            return False
-
-    def get_users(self):
-        """\
-        Get list of known users.
-
-        @return: returns list of known users
-        @rtype: C{list}
-
-        """
-        if self._import_nameservice_module(service=self.get_userdb_service()):
-            return self.nameservice_module.X2GoBrokerNameService().get_users()
-        else:
-            return False
-
-    def has_group(self, group):
-        """\
-        Test if the broker knows group C{<group>}.
-
-        @param group: test for existence of this group
-        @type group: C{unicode}
-
-        @return: returns C{True} if a group exists
-        @rtype: C{bool}
-
-        """
-        if self._import_nameservice_module(service=self.get_groupdb_service()):
-            return self.nameservice_module.X2GoBrokerNameService().has_group(group=group)
-        else:
-            return False
-
-    def get_groups(self):
-        """\
-        Get list of known groups.
-
-        @return: returns list of known groups
-        @rtype: C{list}
-
-        """
-        if self._import_nameservice_module(service=self.get_groupdb_service()):
-            return self.nameservice_module.X2GoBrokerNameService().get_groups()
-        else:
-            return False
-
-    def is_group_member(self, username, group, primary_groups=False):
-        """\
-        Check if a user is member of a given group.
-
-        @return: returns C{True} if the user is member of the given group
-        @rtype: C{bool}
-
-        """
-        if self._import_nameservice_module(service=self.get_groupdb_service()):
-            return self.nameservice_module.X2GoBrokerNameService().is_group_member(username=username, group=group, primary_groups=primary_groups)
-        else:
-            return []
-
-    def get_group_members(self, group, primary_groups=False):
-        """\
-        Get the list of members in group C{<group>}.
-
-        @param group: valid group name
-        @type group: C{unicode}
-        @param primary_groups: include primary groups found with the user db service
-        @type primary_groups: C{bool}
-
-        @return: list of users belonging to the given group
-        @rtype: C{list}
-
-        """
-        if self._import_nameservice_module(service=self.get_groupdb_service()):
-            return self.nameservice_module.X2GoBrokerNameService().get_group_members(group=group, primary_groups=primary_groups)
-        else:
-            return []
-
-    def check_access(self, username='', password='', authid=None, ):
-        """\
-        Check if a given user with a given password may gain access to the
-        X2Go session broker.
-
-        @param username: a username known to the session broker
-        @type username: C{unicode}
-        @param password: a password that authenticates the user against the X2Go session broker
-        @type password: C{unicode}
-
-        @return: returns C{True} if the authentication has been successful
-        @rtype: C{bool}
-
-        """
-        ### FOR INTRANET LOAD BALANCER WE MAY JUST ALLOW ACCESS TO EVERYONE
-        ### This is handled through the config file, normally /etc/x2go/x2gobroker.conf
-
-        if not self.config.get_value('global', 'check-credentials'):
-            return True
-
-        ### IMPLEMENT YOUR AUTHENTICATION LOGIC IN THE self._do_authenticate(**kwargs) METHOD
-        ### when inheriting from the base.X2GoBroker class.
-
-        access = False
-        access = self._do_authenticate(username=username, password=password)
-
-        ### HANDLING OF DYNAMIC AUTHENTICATION ID HASHES
-
-        # using authid as extra security?
-        if self.config.get_value('global', 'use-authid'):
-
-            if type(authid) is types.StringType:
-                authid = unicode(authid)
-
-            if self.config.get_value('global', 'use-static-authid'):
-
-                # evaluate access based on static authentication ID feature
-                access = access and ( authid == self.config.get_value('global', 'authid') )
-
-            else:
-
-                # evaluate access based on dynamic authentication ID feature
-                if self._dynamic_authid_map.has_key(username):
-                    access = access and ( authid == self._dynamic_authid_map[username] )
-                    if access:
-                        self._dynamic_authid_map[username] = uuid.uuid5(namespace=authid, name=username)
-
-                else:
-                    access = access and ( authid == self.config.get_value('global', 'authid') )
-                    if access:
-                        # generate a first uuid, initialize the dynamic authencation ID security feature
-                        self._dynamic_authid_map[username] = uuid.uuid4()
-
-        return access
-
-    def get_next_authid(self, username):
-        """\
-        Get the next expected authentication ID for the given user name.
-
-        @param username: query next auth ID for this user
-        @type username: C{unicode}
-
-        @return: returns next authentication ID for the given username, None if no auth ID has been generated, yet.
-        @rtype: C{unicode} or C{None}
-
-        """
-        try:
-            return self._dynamic_authid_map[username]
-        except KeyError:
-            return None
-
-    def list_profiles(self, username):
-        """\
-        Retrieve a list of available session profiles for the authenticated user.
-
-        @param username: query session list for this user
-        @type username: C{unicode}
-
-        return: list of profile dictionaries
-        rtype: C{dict}
-
-        """
-        list_of_profiles = {}
-        for profile_id in self.get_profile_ids():
-            profile = self.get_profile(profile_id)
-            acls = self.get_profile_acls(profile_id)
-
-            if self.check_acls(username, acls):
-                list_of_profiles.update(profile)
-
-        return list_of_profiles
-
-    def select_profile(self, profile_name='DEFAULT'):
-        """\
-        Start/resume a session by selecting a profile name offered by the X2Go client.
-
-        The X2Go server that the session is launched on is selected automatically by the X2Go session
-        broker.
-
-        @param profile_name: a dictionary object containing information on a selected session profile
-        @type profile_name: C{dict}
-
-        """
-        return {}
-
-    def change_password(self, new='', old=''):
-        """\
-        Modify the authenticated user's password on the X2Go infrastructure (normally, one user
-        in one X2Go site setup should have the same password on all machines).
-
-        """
-        return False
diff --git a/x2gobroker/backends/inifile.py b/x2gobroker/backends/inifile.py
deleted file mode 100644
index f5080f1..0000000
--- a/x2gobroker/backends/inifile.py
+++ /dev/null
@@ -1,90 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# Copyright (C) 2012 by Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
-# Copyright (C) 2012 by Oleksandr Shneyder <oleksandr.shneyder at obviously-nice.de>
-#
-# X2Go Session Broker is free software; you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# X2Go Session Broker is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program; if not, write to the
-# Free Software Foundation, Inc.,
-# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
-
-"""\
-X2goBrokerINIFILE class - a simple X2GoBroker implementations that uses text-based config files only
-and does not support load balancing.
-
-"""
-__NAME__ = 'x2gobroker-pylib'
-
-# modules
-
-# Python X2GoBroker modules
-import base
-import x2gobroker.config
-import x2gobroker.defaults
-
-class X2GoBroker(base.X2GoBroker):
-    """\
-
-    """
-class X2GoBroker(base.X2GoBroker):
-
-    backend_name = 'inifile'
-
-    def __init__(self, profile_config_file=None, profile_config_defaults=None, **kwargs):
-        """\
-        @param config_file: path to the X2Go Session Broker configuration file (x2gobroker.conf)
-        @type config_file: C{unicode}
-        @param profile_config_file: path to the backend's session profile configuration (x2gobroker-sessionprofiles.conf)
-        @type profile_config_file: C{unicode} 
-
-        """
-        base.X2GoBroker.__init__(self, **kwargs)
-
-        if profile_config_file is None: profile_config_file = x2gobroker.defaults.X2GOBROKER_SESSIONPROFILES
-        if profile_config_defaults is None: profile_config_defaults = x2gobroker.defaults.X2GOBROKER_SESSIONPROFILE_DEFAULTS
-        self.session_profiles = x2gobroker.config.X2GoBrokerConfigFile(config_files=profile_config_file, defaults=profile_config_defaults)
-
-    def get_profile_ids(self):
-
-        return self.session_profiles.list_sections()
-
-    def get_profile_defaults(self):
-
-        profile_defaults = self.session_profiles.get_defaults()
-        for key in profile_defaults.keys():
-            if key.startswith('acl-'):
-                del profile_defaults[key]
-        return profile_defaults
-
-    def get_profile(self, profile_id):
-
-        profile = self.session_profiles.get_section(profile_id)
-        for key in profile.keys():
-            if key.startswith('acl-'):
-                del profile[key]
-        return profile
-
-    def get_profile_acls(self, profile_id):
-
-        profile = self.session_profiles.get_section(profile_id)
-        for key in profile.keys():
-            if not key.startswith('acl-'):
-                del profile[key]
-        return profile
-
-    def select_profile(self, profile_name):
-
-        selectprofile_output = {
-            'server': 'localhost:22',
-        }
-        return selectprofile_output
diff --git a/x2gobroker/backends/ldap.py b/x2gobroker/backends/ldap.py
deleted file mode 100644
index 62b9801..0000000
--- a/x2gobroker/backends/ldap.py
+++ /dev/null
@@ -1,33 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# Copyright (C) 2012 by Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
-# Copyright (C) 2012 by Oleksandr Shneyder <oleksandr.shneyder at obviously-nice.de>
-#
-# X2Go Session Broker is free software; you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# X2Go Session Broker is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program; if not, write to the
-# Free Software Foundation, Inc.,
-# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
-
-"""\
-X2goBrokerLDAP class - a production X2GoBroker implementations that uses LDAP as configuration backend
-
-"""
-__NAME__ = 'x2gobroker-pylib'
-
-# modules
-import x2gobroker.base
-
-class X2GoBroker(x2gobroker.base.X2GoBroker):
-    """\
-
-    """
diff --git a/x2gobroker/backends/zeroconf.py b/x2gobroker/backends/zeroconf.py
deleted file mode 100644
index 078b9ca..0000000
--- a/x2gobroker/backends/zeroconf.py
+++ /dev/null
@@ -1,84 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# Copyright (C) 2012 by Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
-# Copyright (C) 2012 by Oleksandr Shneyder <oleksandr.shneyder at obviously-nice.de>
-#
-# X2Go Session Broker is free software; you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# X2Go Session Broker is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program; if not, write to the
-# Free Software Foundation, Inc.,
-# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
-
-"""\
-X2goBrokerZEROCONF class - a demo X2GoBroker implementations that needs not configuration at all
-
-"""
-__NAME__ = 'x2gobroker-pylib'
-
-# modules
-import uuid
-
-# Python X2GoBroker modules
-import base
-
-class X2GoBroker(base.X2GoBroker):
-
-    backend_name = 'zeroconf'
-
-    def list_profiles(self, username):
-
-        list_of_profiles = {
-            uuid.uuid4(): {
-                'user': u'',
-                'defsndport': True,
-                'useiconv': False,
-                'iconvfrom': u'UTF-8',
-                'height': 600,
-                'export': u'',
-                'quality': 9,
-                'fullscreen': False,
-                'layout': u'',
-                'useexports': 1,
-                'width': 800,
-                'speed': 2,
-                'soundsystem': u'pulse',
-                'print': True,
-                'type': u'auto',
-                'sndport': 4713,
-                'xinerama': True,
-                'variant': u'',
-                'usekbd': True,
-                'fstunnel': True,
-                'applications': [u'TERMINAL',u'WWWBROWSER',u'MAILCLIENT',u'OFFICE',],
-                'host': u'localhost',
-                'multidisp': 0,
-                'sshproxyport': 22,
-                'sound': True,
-                'rootless': 0,
-                'name': u'LOCALHOST',
-                'iconvto': u'UTF-8',
-                'soundtunnel': True,
-                'command': self.get_backend_value(self.backend_name, u'desktop-shell'),
-                'dpi': 96,
-                'sshport': 22,
-                'setdpi': 0,
-                'pack': u'16m-jpeg',
-            },
-        }
-        return list_of_profiles
-
-    def select_profile(self, profile_name):
-
-        selectprofile_output = {
-            'server': 'localhost:22',
-        }
-        return selectprofile_output
diff --git a/x2gobroker/tests/test_backend_base.py b/x2gobroker/tests/test_broker_base.py
similarity index 90%
rename from x2gobroker/tests/test_backend_base.py
rename to x2gobroker/tests/test_broker_base.py
index d08538d..ec83e94 100644
--- a/x2gobroker/tests/test_backend_base.py
+++ b/x2gobroker/tests/test_broker_base.py
@@ -22,7 +22,7 @@ import tempfile
 import copy
 
 # Python X2GoBroker modules
-import x2gobroker.backends.base
+import x2gobroker.brokers.base
 import x2gobroker.defaults
 
 class TestX2GoBrokerBackendBase(unittest.TestCase):
@@ -34,7 +34,7 @@ class TestX2GoBrokerBackendBase(unittest.TestCase):
         tf = tempfile.NamedTemporaryFile()
         print >> tf, _config
         tf.seek(0)
-        return x2gobroker.backends.base.X2GoBroker(config_file=tf.name, config_defaults=_config_defaults)
+        return x2gobroker.brokers.base.X2GoBroker(config_file=tf.name, config_defaults=_config_defaults)
 
     ### TEST CONFIGURATION: <backend> >> enable = true|false
 
@@ -48,7 +48,7 @@ enable = false
         tf = tempfile.NamedTemporaryFile()
         print >> tf, _config
         tf.seek(0)
-        base_backend = x2gobroker.backends.base.X2GoBroker(config_file=tf.name, config_defaults=_config_defaults)
+        base_backend = x2gobroker.brokers.base.X2GoBroker(config_file=tf.name, config_defaults=_config_defaults)
         self.assertEqual(base_backend.is_enabled(), False)
         _config = """
 [base]
@@ -57,7 +57,7 @@ enable = true
         tf = tempfile.NamedTemporaryFile()
         print >> tf, _config
         tf.seek(0)
-        base_backend = x2gobroker.backends.base.X2GoBroker(config_file=tf.name)
+        base_backend = x2gobroker.brokers.base.X2GoBroker(config_file=tf.name)
         self.assertEqual(base_backend.is_enabled(), True)
         tf.close()
 
@@ -76,7 +76,7 @@ enable = true
         tf = tempfile.NamedTemporaryFile()
         print >> tf, _config
         tf.seek(0)
-        base_backend = x2gobroker.backends.base.X2GoBroker(config_file=tf.name)
+        base_backend = x2gobroker.brokers.base.X2GoBroker(config_file=tf.name)
         self.assertEqual(base_backend.get_authentication_mechanism(), 'foo-auth-mech')
         _config = """
 [global]
@@ -89,7 +89,7 @@ auth-mech = bar-auth-mech
         tf = tempfile.NamedTemporaryFile()
         print >> tf, _config
         tf.seek(0)
-        base_backend = x2gobroker.backends.base.X2GoBroker(config_file=tf.name, config_defaults=_config_defaults)
+        base_backend = x2gobroker.brokers.base.X2GoBroker(config_file=tf.name, config_defaults=_config_defaults)
         self.assertEqual(base_backend.get_authentication_mechanism(), 'bar-auth-mech')
         tf.close()
 
@@ -108,7 +108,7 @@ enable = true
         tf = tempfile.NamedTemporaryFile()
         print >> tf, _config
         tf.seek(0)
-        base_backend = x2gobroker.backends.base.X2GoBroker(config_file=tf.name)
+        base_backend = x2gobroker.brokers.base.X2GoBroker(config_file=tf.name)
         self.assertEqual(base_backend.get_userdb_service(), 'foo-user-db')
         _config = """
 [global]
@@ -121,7 +121,7 @@ user-db = bar-user-db
         tf = tempfile.NamedTemporaryFile()
         print >> tf, _config
         tf.seek(0)
-        base_backend = x2gobroker.backends.base.X2GoBroker(config_file=tf.name, config_defaults=_config_defaults)
+        base_backend = x2gobroker.brokers.base.X2GoBroker(config_file=tf.name, config_defaults=_config_defaults)
         self.assertEqual(base_backend.get_userdb_service(), 'bar-user-db')
         tf.close()
 
@@ -140,7 +140,7 @@ enable = true
         tf = tempfile.NamedTemporaryFile()
         print >> tf, _config
         tf.seek(0)
-        base_backend = x2gobroker.backends.base.X2GoBroker(config_file=tf.name)
+        base_backend = x2gobroker.brokers.base.X2GoBroker(config_file=tf.name)
         self.assertEqual(base_backend.get_groupdb_service(), 'foo-group-db')
         _config = """
 [global]
@@ -153,7 +153,7 @@ group-db = bar-group-db
         tf = tempfile.NamedTemporaryFile()
         print >> tf, _config
         tf.seek(0)
-        base_backend = x2gobroker.backends.base.X2GoBroker(config_file=tf.name, config_defaults=_config_defaults)
+        base_backend = x2gobroker.brokers.base.X2GoBroker(config_file=tf.name, config_defaults=_config_defaults)
         self.assertEqual(base_backend.get_groupdb_service(), 'bar-group-db')
         tf.close()
 
@@ -171,7 +171,7 @@ enable = true
         tf = tempfile.NamedTemporaryFile()
         print >> tf, _config
         tf.seek(0)
-        base_backend = x2gobroker.backends.base.X2GoBroker(config_file=tf.name)
+        base_backend = x2gobroker.brokers.base.X2GoBroker(config_file=tf.name)
         self.assertEqual(base_backend.get_users(), [])
         self.assertEqual(base_backend.has_user('any-user'), False)
         self.assertEqual(base_backend.get_groups(), [])
@@ -193,7 +193,7 @@ enable = true
         tf = tempfile.NamedTemporaryFile()
         print >> tf, _config
         tf.seek(0)
-        base_backend = x2gobroker.backends.base.X2GoBroker(config_file=tf.name)
+        base_backend = x2gobroker.brokers.base.X2GoBroker(config_file=tf.name)
         self.assertTrue( ( 'root' in base_backend.get_users() ) )
         self.assertEqual(base_backend.has_user('root'), True)
         self.assertTrue( ( 'root' in base_backend.get_groups() ) )
@@ -215,7 +215,7 @@ check-credentials = false
         tf = tempfile.NamedTemporaryFile()
         print >> tf, _config
         tf.seek(0)
-        base_backend = x2gobroker.backends.base.X2GoBroker(config_file=tf.name, config_defaults=_config_defaults)
+        base_backend = x2gobroker.brokers.base.X2GoBroker(config_file=tf.name, config_defaults=_config_defaults)
         self.assertEqual(base_backend.check_access(), True)
         tf.close()
 
diff --git a/x2gobroker/tests/test_backend_inifile.py b/x2gobroker/tests/test_broker_inifile.py
similarity index 93%
rename from x2gobroker/tests/test_backend_inifile.py
rename to x2gobroker/tests/test_broker_inifile.py
index f51fbad..3a55f34 100644
--- a/x2gobroker/tests/test_backend_inifile.py
+++ b/x2gobroker/tests/test_broker_inifile.py
@@ -22,7 +22,7 @@ import tempfile
 import copy
 
 # Python X2GoBroker modules
-import x2gobroker.backends.inifile
+import x2gobroker.brokers.inifile
 import x2gobroker.defaults
 
 class TestX2GoBrokerBackendInifile(unittest.TestCase):
@@ -30,7 +30,7 @@ class TestX2GoBrokerBackendInifile(unittest.TestCase):
     ### TEST SESSION PROFILES: get_profile_ids()
 
     def test_getprofileids(self):
-        inifile_backend = x2gobroker.backends.inifile.X2GoBroker(profile_config_file='../../etc/x2gobroker-sessionprofiles.conf')
+        inifile_backend = x2gobroker.brokers.inifile.X2GoBroker(profile_config_file='../../etc/x2gobroker-sessionprofiles.conf')
         _profile_ids = inifile_backend.get_profile_ids()
         self.assertEqual(len(_profile_ids), 5)
         _expected_profile_ids = ['pool-A-server-A', 'pool-A-server-B', 'pool-A-server-C', 'pool-B-server-D-LXDE', 'pool-C-XFCE', ]
@@ -42,7 +42,7 @@ class TestX2GoBrokerBackendInifile(unittest.TestCase):
     ### TEST SESSION PROFILES: get_profile_defaults()
 
     def test_getprofiledefaults(self):
-        inifile_backend = x2gobroker.backends.inifile.X2GoBroker(profile_config_file='../../etc/x2gobroker-sessionprofiles.conf')
+        inifile_backend = x2gobroker.brokers.inifile.X2GoBroker(profile_config_file='../../etc/x2gobroker-sessionprofiles.conf')
         _profile_defaults = inifile_backend.get_profile_defaults()
         _expected_profile_defaults = copy.deepcopy(x2gobroker.defaults.X2GOBROKER_SESSIONPROFILE_DEFAULTS['DEFAULT'])
         for key in copy.deepcopy(_expected_profile_defaults):
@@ -84,7 +84,7 @@ acl-users-order = deny-allow
         tf = tempfile.NamedTemporaryFile()
         print >> tf, _session_profiles
         tf.seek(0)
-        inifile_backend = x2gobroker.backends.inifile.X2GoBroker(profile_config_file=tf.name)
+        inifile_backend = x2gobroker.brokers.inifile.X2GoBroker(profile_config_file=tf.name)
         _expected_defaults = {
             'exports': '',
             'fullscreen': False,
@@ -163,7 +163,7 @@ acl-users-order = deny-allow
         tf = tempfile.NamedTemporaryFile()
         print >> tf, _session_profiles
         tf.seek(0)
-        inifile_backend = x2gobroker.backends.inifile.X2GoBroker(profile_config_file=tf.name)
+        inifile_backend = x2gobroker.brokers.inifile.X2GoBroker(profile_config_file=tf.name)
         _expected_acl_defaults = {
             'acl-clients-deny': ['ALL'],
             'acl-clients-allow': ['10.0.0.0/16','10.1.0.0/16','admin-1.intern','admin-2.intern'],
@@ -203,7 +203,7 @@ acl-users-order = deny-allow
 #        _output = {
 #            'server': 'localhost:22',
 #        }
-#        zeroconf_backend = x2gobroker.backends.zeroconf.X2GoBroker()
+#        zeroconf_backend = x2gobroker.brokers.zeroconf.X2GoBroker()
 #        self.assertEqual(zeroconf_backend.select_profile('profile_bar'), _output)
 
 
diff --git a/x2gobroker/tests/test_backend_zeroconf.py b/x2gobroker/tests/test_broker_zeroconf.py
similarity index 94%
rename from x2gobroker/tests/test_backend_zeroconf.py
rename to x2gobroker/tests/test_broker_zeroconf.py
index 5f594eb..859cd40 100644
--- a/x2gobroker/tests/test_backend_zeroconf.py
+++ b/x2gobroker/tests/test_broker_zeroconf.py
@@ -20,7 +20,7 @@
 import unittest
 
 # Python X2GoBroker modules
-import x2gobroker.backends.zeroconf
+import x2gobroker.brokers.zeroconf
 
 class TestX2GoBrokerBackendZeroconf(unittest.TestCase):
 
@@ -65,7 +65,7 @@ class TestX2GoBrokerBackendZeroconf(unittest.TestCase):
                 'pack': u'16m-jpeg',
             },
         }
-        zeroconf_backend = x2gobroker.backends.zeroconf.X2GoBroker()
+        zeroconf_backend = x2gobroker.brokers.zeroconf.X2GoBroker()
         _profiles = zeroconf_backend.list_profiles('user_foo')
         self.assertEqual(len(_profiles.keys()), 1)
         _key = _profiles.keys()[0]
@@ -81,7 +81,7 @@ class TestX2GoBrokerBackendZeroconf(unittest.TestCase):
         _output = {
             'server': 'localhost:22',
         }
-        zeroconf_backend = x2gobroker.backends.zeroconf.X2GoBroker()
+        zeroconf_backend = x2gobroker.brokers.zeroconf.X2GoBroker()
         self.assertEqual(zeroconf_backend.select_profile('profile_bar'), _output)
 
 
diff --git a/x2gobroker/tests/test_web_plain_base.py b/x2gobroker/tests/test_web_plain_base.py
index cbf166a..efb4aea 100644
--- a/x2gobroker/tests/test_web_plain_base.py
+++ b/x2gobroker/tests/test_web_plain_base.py
@@ -23,7 +23,7 @@ from paste.fixture import TestApp
 from nose.tools import *
 
 # Python X2GoBroker modules
-import x2gobroker.backends.base
+import x2gobroker.brokers.base
 import x2gobroker.defaults
 
 from x2gobroker.web.plain import *
diff --git a/x2gobroker/tests/test_web_plain_zeroconf.py b/x2gobroker/tests/test_web_plain_zeroconf.py
index 4d6020e..70fcb7f 100644
--- a/x2gobroker/tests/test_web_plain_zeroconf.py
+++ b/x2gobroker/tests/test_web_plain_zeroconf.py
@@ -23,7 +23,7 @@ from paste.fixture import TestApp
 from nose.tools import *
 
 # Python X2GoBroker modules
-import x2gobroker.backends.base
+import x2gobroker.brokers.base
 import x2gobroker.defaults
 
 from x2gobroker.web.plain import *
diff --git a/x2gobroker/web/html.py b/x2gobroker/web/html.py
index 07802eb..c7e40ba 100644
--- a/x2gobroker/web/html.py
+++ b/x2gobroker/web/html.py
@@ -75,8 +75,8 @@ $output
 
         # silence pyflakes...
         broker_backend = None
-        exec("import x2gobroker.backends.{backend}".format(backend=backend))
-        exec("broker_backend = x2gobroker.backends.{backend}.X2GoBroker()".format(backend=backend))
+        exec("import x2gobroker.brokers.{backend}".format(backend=backend))
+        exec("broker_backend = x2gobroker.brokers.{backend}.X2GoBroker()".format(backend=backend))
         global_config = broker_backend.get_global_config()
         backend_config = broker_backend.get_backend_config(backend)
 
diff --git a/x2gobroker/web/plain.py b/x2gobroker/web/plain.py
index 6a55fde..2fd001f 100644
--- a/x2gobroker/web/plain.py
+++ b/x2gobroker/web/plain.py
@@ -52,8 +52,8 @@ class X2GoBrokerWebPlain:
         # silence pyflakes...
         broker_backend = None
         # dynamically detect broker backend from given URL
-        exec("import x2gobroker.backends.{backend}".format(backend=backend))
-        exec("broker_backend = x2gobroker.backends.{backend}.X2GoBroker()".format(backend=backend))
+        exec("import x2gobroker.brokers.{backend}".format(backend=backend))
+        exec("broker_backend = x2gobroker.brokers.{backend}.X2GoBroker()".format(backend=backend))
         global_config = broker_backend.get_global_config()
         backend_config = broker_backend.get_backend_config()
 


hooks/post-receive
-- 
x2gobroker.git (HTTP(S) Session broker for X2Go)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "x2gobroker.git" (HTTP(S) Session broker for X2Go).




More information about the x2go-commits mailing list