Code

Updated posix
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 26 Jan 2010 13:19:55 +0000 (13:19 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 26 Jan 2010 13:19:55 +0000 (13:19 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15319 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/plugins/personal/posix/class_posixAccount.inc
gosa-core/plugins/personal/posix/groupSelect/class_filterLDAPBlacklist.inc [new file with mode: 0644]
gosa-core/plugins/personal/posix/groupSelect/group-filter.xml
gosa-core/plugins/personal/posix/trustSelect/trust-filter.xml

index bef6a4264b4ece65270004f10937e941a70a1917..2bd4f5fac4abff81c49ae30ed94df352ee296778 100644 (file)
@@ -402,11 +402,17 @@ class posixAccount extends plugin
 
     /* Show ws dialog */
     if ($this->trustSelect){
+
+      // Build up blocklist
+      session::set('filterBlacklist', array('cn' => array_values($this->accessTo)));
       return($this->trustSelect->execute());
     }
 
     /* Manage group add dialog */
     if ($this->groupSelect){
+      
+      // Build up blocklist
+      session::set('filterBlacklist', array('dn' => array_keys($this->groupMembership)));
       return($this->groupSelect->execute());
     }
 
diff --git a/gosa-core/plugins/personal/posix/groupSelect/class_filterLDAPBlacklist.inc b/gosa-core/plugins/personal/posix/groupSelect/class_filterLDAPBlacklist.inc
new file mode 100644 (file)
index 0000000..b78f2b2
--- /dev/null
@@ -0,0 +1,31 @@
+<?php
+
+class filterLDAPBlacklist {
+
+  static function query($base, $scope, $filter, $attributes, $category, $objectStorage= "")
+  {
+    $result = filterLDAP::query($base, $scope, $filter, $attributes, $category, $objectStorage);
+    return(filterLDAPBlacklist::filterByBlacklist($result));
+  }
+
+  static function filterByBlacklist($entries)
+  {
+    if(session::is_set('filterBlacklist')){
+      $blist = session::get('filterBlacklist');
+      foreach($blist as $attr_name => $attr_values){
+        foreach($attr_values as $match){
+          foreach($entries as $id => $entry){
+            if(isset($entry[$attr_name])){
+              $test = $entry[$attr_name];
+              if(!is_array($test)) $test = array($test);
+              if(in_array($match, $test)) unset($entries[$id]);
+            }
+          }
+        }
+      }
+    }
+    return(array_values($entries));
+  }
+}
+
+?>
index 00d28e4b513c51187fb111f5095a6e2381e8a574..5a43637b3619a8d1f1ea65ee716aaff111dc6c97 100644 (file)
@@ -9,7 +9,7 @@
 
   <search>
     <query>
-      <backend>LDAP</backend>
+      <backend>LDAPBlacklist</backend>
       <filter>(&amp;(objectClass=posixGroup)$NAME(|$PRIMARY$MAIL$SAMBA))</filter>
       <attribute>dn</attribute>
       <attribute>objectClass</attribute>
@@ -53,7 +53,7 @@
     <set>(|(cn=*$*)(description=*$*))</set>
     <alphabet>true</alphabet>
     <autocomplete>
-      <backend>LDAP</backend>
+      <backend>LDAPBlacklist</backend>
       <filter>(&amp;(objectClass=posixGroup)(|(cn=*$NAME*)(description=*$NAME*)))</filter>
       <attribute>cn</attribute>
       <frequency>0.5</frequency>
index c0b3555642fa1073af32f27a96d5217426fbab9c..10ea5d554ee75fefe3d8598035d8c0a37f7f03f6 100644 (file)
@@ -9,7 +9,7 @@
 
  <search>
     <query>
-      <backend>LDAP</backend>
+      <backend>LDAPBlacklist</backend>
       <filter>(&amp;(|$SERVER $WORKSTATION $TERMINAL)$NAME)</filter>
       <attribute>dn</attribute>
       <attribute>objectClass</attribute>
@@ -29,7 +29,7 @@
     <set>(cn=*$*)</set>
     <alphabet>false</alphabet>
     <autocomplete>
-      <backend>SYSTEMS</backend>
+      <backend>LDAPBlacklist</backend>
       <filter>(cn=*$NAME*)</filter>
       <attribute>cn</attribute>
       <frequency>0.5</frequency>