[X2go-Commits] x2gobroker.git - master (branch) updated: 4bef261502ad0d4d20751eca0073f5f295aa99ff

X2Go dev team git-admin at x2go.org
Thu Dec 6 15:58:00 CET 2012


The branch, master has been updated
       via  4bef261502ad0d4d20751eca0073f5f295aa99ff (commit)
       via  7bb4760eb14f26e040a9f460d29924cfa39d654f (commit)
      from  8206b502bce2392b6ca4551d964860c4a0848cef (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 -----------------------------------------------------------------
commit 4bef261502ad0d4d20751eca0073f5f295aa99ff
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Thu Dec 6 15:57:58 2012 +0100

    add get_profile_acls() method to base.X2GoBroker

commit 7bb4760eb14f26e040a9f460d29924cfa39d654f
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Thu Dec 6 15:56:41 2012 +0100

    add test for get_profile_acls (inifile backend), fix get_profile_acls

-----------------------------------------------------------------------

Summary of changes:
 x2gobroker/backends/base.py              |   13 ++++++
 x2gobroker/defaults.py                   |   12 +++---
 x2gobroker/tests/test_backend_inifile.py |   67 ++++++++++++++++++++++++++++++
 3 files changed, 86 insertions(+), 6 deletions(-)

The diff of changes is:
diff --git a/x2gobroker/backends/base.py b/x2gobroker/backends/base.py
index b590fdb..19cab3c 100644
--- a/x2gobroker/backends/base.py
+++ b/x2gobroker/backends/base.py
@@ -144,6 +144,19 @@ class X2GoBroker(object):
         """
         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 test_connection(self):
         #if($cgi->param('task') eq 'testcon')
         #{
diff --git a/x2gobroker/defaults.py b/x2gobroker/defaults.py
index b9f477b..3c561c9 100644
--- a/x2gobroker/defaults.py
+++ b/x2gobroker/defaults.py
@@ -113,14 +113,14 @@ X2GOBROKER_SESSIONPROFILE_DEFAULTS = {
         'sshport': 22,
         'setdpi': 0,
         'pack': '16m-jpeg',
-        'acl-users-allowed': ['ALL'],
-        'acl-users-denied': [],
+        'acl-users-allow': ['ALL'],
+        'acl-users-deny': [],
         'acl-users-order': '',
-        'acl-groups-allowed': ['ALL'],
-        'acl-groups-denied': [],
+        'acl-groups-allow': ['ALL'],
+        'acl-groups-deny': [],
         'acl-groups-order': '',
-        'acl-clients-allowed': ['ALL'],
-        'acl-clients-denied': [],
+        'acl-clients-allow': ['ALL'],
+        'acl-clients-deny': [],
         'acl-clients-order': '',
         'acl-any-order': 'deny-allow',
     },
diff --git a/x2gobroker/tests/test_backend_inifile.py b/x2gobroker/tests/test_backend_inifile.py
index f9e7f2e..bec9381 100644
--- a/x2gobroker/tests/test_backend_inifile.py
+++ b/x2gobroker/tests/test_backend_inifile.py
@@ -130,6 +130,73 @@ acl-users-order = deny-allow
         for key in _profile3.keys():
             self.assertTrue( ( key in _expected_profile3.keys() ) and ( _profile3[key] == _expected_profile3[key] ) )
 
+    ### TEST SESSION PROFILES: get_profile_acls(profile_id)
+
+    def test_getprofileacls(self):
+        _session_profiles = """
+[DEFAULT]
+exports =
+fullscreen = false
+width = 800
+height = 600
+applications = TERMINAL, WWWBROWSER
+acl-clients-deny = ALL
+acl-clients-allow = 10.0.0.0/16,10.1.0.0/16,admin-1.intern,admin-2.intern
+
+[testprofile1]
+user = foo
+cmd = GNOME
+
+[testprofile2]
+user = foo
+cmd = GNOME
+acl-clients-deny = 10.0.2.0/24,ALL
+
+[testprofile3]
+user = bar
+cmd = KDE
+fullscreen = true
+acl-users-deny = ALL
+acl-users-allow = foo,bar
+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)
+        _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'],
+        }
+        _expected_acls_profile1 = copy.deepcopy(_expected_acl_defaults)
+        _expected_acls_profile2 = copy.deepcopy(_expected_acl_defaults)
+        _expected_acls_profile2.update({
+            'acl-clients-deny': ['10.0.2.0/24','ALL'],
+        })
+        _expected_acls_profile3 = copy.deepcopy(_expected_acl_defaults)
+        _expected_acls_profile3.update({
+            'acl-users-deny': ['ALL'],
+            'acl-users-allow': ['foo','bar'],
+            'acl-users-order': 'deny-allow',
+        })
+        _acls_profile1 = inifile_backend.get_profile_acls('testprofile1')
+        for key in _expected_acls_profile1.keys():
+            self.assertTrue( ( key in _acls_profile1.keys() ) )
+        for key in _acls_profile1.keys():
+            self.assertTrue( ( key in _expected_acls_profile1.keys()  and _acls_profile1[key] == _expected_acls_profile1[key] ) )
+
+        _acls_profile2 = inifile_backend.get_profile_acls('testprofile2')
+        for key in _expected_acls_profile2.keys():
+            self.assertTrue( ( key in _acls_profile2.keys() ) )
+        for key in _acls_profile2.keys():
+            self.assertTrue( ( key in _expected_acls_profile2.keys() ) and ( _acls_profile2[key] == _expected_acls_profile2[key] ) )
+
+        _acls_profile3 = inifile_backend.get_profile_acls('testprofile3')
+        for key in _expected_acls_profile3.keys():
+            self.assertTrue( ( key in _acls_profile3.keys() ) )
+        for key in _acls_profile3.keys():
+            self.assertTrue( ( key in _expected_acls_profile3.keys() ) and ( _acls_profile3[key] == _expected_acls_profile3[key] ) )
+
     ### TEST: select_profile() method
 
 #    def test_profileselection(self):


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