Code

Updated tag handling for several lists
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 23 Aug 2006 06:20:00 +0000 (06:20 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 23 Aug 2006 06:20:00 +0000 (06:20 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@4501 594d385d-05f5-0310-b6e9-bd551577e9d8

include/class_config.inc
plugins/admin/applications/class_divListApplication.inc
plugins/admin/groups/class_groupGeneric.inc
plugins/admin/systems/class_printGeneric.inc
plugins/personal/environment/class_hotplugDialog.inc
plugins/personal/environment/class_selectPrinterDialog.inc
plugins/personal/posix/class_posixAccount.inc

index f413ecb62a8be8f3b0953dce4f1815322cd1da1a..339eca51fa81568fbe32d504acbb43a1207faba1 100644 (file)
@@ -633,7 +633,16 @@ class config  {
   function getShareList($listboxEntry = false)
   {
     $ldap= $this->get_ldap_link();
-    $a_res = $ldap->search("(objectClass=goShareServer)",array("goExportEntry","cn"));
+
+    /* Set tag attribute if we've tagging activated */
+    $tag= "";
+    $ui= get_userinfo();
+    if ($ui->gosaUnitTag != "" && isset($this->current['STRICT_UNITS']) &&
+        preg_match('/TRUE/i', $this->current['STRICT_UNITS'])){
+      $tag= "(gosaUnitTag=".$ui->gosaUnitTag.")";
+    }
+
+    $a_res = $ldap->search("(&(objectClass=goShareServer)$tag(objectClass=goServer))",array("goExportEntry","cn"));
     $return= array();
     while($entry = $ldap->fetch($a_res)){
       if(isset($entry['goExportEntry']['count'])){
index b6f63d0448443ee2c43da99dce7862534e904874..9056297824fe64aca306ca4b59ee2c096497255d 100755 (executable)
@@ -158,7 +158,7 @@ class divListApplication extends MultiSelectWindow
       $actions.= "<input class='center' type='image'
         src='images/edit.png' alt='"._("edit")."' name='appl_edit_%KEY%' title='"._("Edit this entry")."'>";
       if($is_freezed){
-        $actions.= "<img src='images/empty.png' width='32' alt='&nbsp;' >";
+        $actions.= "<img src='images/empty.png' width='16' alt='&nbsp;' >";
       }else{
         $actions.= "<input class='center' type='image'
           src='images/edittrash.png' alt='"._("delete")."' name='appl_del_%KEY%' title='"._("Delete this entry")."'>";
index 449ee54debe405e7316b45e77b282b80a9c0778c..e1a3ca488d8372fc77b2e5511bc386fbef70c19b 100644 (file)
@@ -439,7 +439,16 @@ class group extends plugin
     /* Create display list of users matching regex & filter 
      */
     $this->displayUsers = array();
-    $filter = "(&(objectClass=gosaAccount)(!(objectClass=gosaUserTemplate))(!(uid=*$))(|(uid=".$regex.")(sn=".$regex.")(givenName=".$regex.")))";
+
+    /* Set tag attribute if we've tagging activated */
+    $tag= "";
+    $ui= get_userinfo();
+    if ($ui->gosaUnitTag != "" && isset($this->config->current['STRICT_UNITS']) &&
+        preg_match('/TRUE/i', $this->config->current['STRICT_UNITS'])){
+      $tag= "(gosaUnitTag=".$ui->gosaUnitTag.")";
+    }
+
+    $filter = "(&(objectClass=gosaAccount)$tag(!(objectClass=gosaUserTemplate))(!(uid=*$))(|(uid=".$regex.")(sn=".$regex.")(givenName=".$regex.")))";
 
     /* Search in current tree or within subtrees depending on the checkbox from filter section */
     if($gufilter['SubSearchGroup']){
index 09d5d80eb05befd181d165536295324d02babae6..8154a89ac994e9dcf1c37bbeba584b67fd4f83d8 100644 (file)
@@ -73,6 +73,7 @@ class printgeneric extends plugin
     }
 
     $this->orig_dn = $this->dn;
+    $ui= get_userinfo();
 
     /* Get printer settings, possibly dn has changed */
     plugin::plugin ($config, $this->dn);
@@ -92,7 +93,6 @@ class printgeneric extends plugin
 
     /* Set base */
     if ($this->dn == "new"){
-      $ui= get_userinfo();
       $this->base= dn2base($ui->dn);
       $this->cn= "";
     } else {
@@ -128,10 +128,17 @@ class printgeneric extends plugin
         unset($this->attrs[$attr]['count']);
       }
 
+      /* Set tag attribute if we've tagging activated */
+      $tag= "";
+      if ($ui->gosaUnitTag != "" && isset($config->current['STRICT_UNITS']) &&
+          preg_match('/TRUE/i', $config->current['STRICT_UNITS'])){
+        $tag= "(gosaUnitTag=".$ui->gosaUnitTag.")";
+      }
+
       if(isset($this->attrs[$attr])){
         foreach($this->attrs[$attr] as $mem){
           if(preg_match("/Group/",$type)){
-            $ldap->search("(&(objectClass=posixGroup)(cn=".$mem."))",array("cn","description"));
+            $ldap->search("(&(objectClass=posixGroup)$tag(cn=".$mem."))",array("cn","description"));
             if($ldap->count()){
               $entry = $ldap->fetch();
               if(isset($entry['cn'])){
@@ -139,7 +146,7 @@ class printgeneric extends plugin
               }
             }
           }else{
-            $ldap->search("(&(objectClass=person)(objectClass=inetOrgPerson)(uid=".$mem."))",array("cn","uid"));
+            $ldap->search("(&(objectClass=person)$tag(objectClass=inetOrgPerson)(uid=".$mem."))",array("cn","uid"));
             if($ldap->count()){
               $entry = $ldap->fetch();
               if(isset($entry['uid'])){
index 3a1ca5e84aecc761daa85850207e776c9baa39f3..52b8675c6fc76989c45b0050eb6e9dbabd9c267e 100644 (file)
@@ -180,7 +180,14 @@ class hotplugDialog extends plugin
     $ldap= $this->config->get_ldap_link();
     $ldap->cd($this->depselect);
 
-    $ldap->search("(&(objectClass=gotoEnvironment)(gotoHotplugDevice=".$this->regex."))",array("gotoHotplugDevice")); 
+    /* Set tag attribute if we've tagging activated */
+    $tag= "";
+    $ui= get_userinfo();
+    if ($ui->gosaUnitTag != "" && isset($this->config->current['STRICT_UNITS']) &&
+        preg_match('/TRUE/i', $this->config->current['STRICT_UNITS'])){
+      $tag= "(gosaUnitTag=".$ui->gosaUnitTag.")";
+    }
+    $ldap->search("(&(objectClass=gotoEnvironment)$tag(gotoHotplugDevice=".$this->regex."))",array("gotoHotplugDevice")); 
 
     $a_return = array();  
     $this->hotplugDeviceList = array();
index 2400b2857909eb1b3fd9a89f33406f0c94de54d8..b39588aa7ed07edb584f9870919774279f0f7bc8 100644 (file)
@@ -85,7 +85,16 @@ class selectPrinterDialog extends plugin
     $a_return=array();
     $ldap = $this->config->get_ldap_link();
     $ldap->cd($this->depselect);
-    $ldap->search("(&(objectClass=gotoPrinter)(cn=".$this->regex."))",array("*"));
+
+    /* Set tag attribute if we've tagging activated */
+    $tag= "";
+    $ui= get_userinfo();
+    if ($ui->gosaUnitTag != "" && isset($this->config->current['STRICT_UNITS']) &&
+        preg_match('/TRUE/i', $this->config->current['STRICT_UNITS'])){
+      $tag= "(gosaUnitTag=".$ui->gosaUnitTag.")";
+    }
+
+    $ldap->search("(&(objectClass=gotoPrinter)$tag(cn=".$this->regex."))",array("*"));
     while($printer = $ldap->fetch()){
 
       if(isset($this->AlreadyAssigned[$printer['cn'][0]])) continue;
index 53ef503de3b3f2ca44bb13de75b1a45fd3c57abd..96e1bd7961836129003c3358bb762db80d0e8629 100644 (file)
@@ -197,9 +197,17 @@ class posixAccount extends plugin
       asort($this->printerList);
     }
 
+    /* Set tag attribute if we've tagging activated */
+    $filter= "(objectClass=posixGroup)";
+    $ui= get_userinfo();
+    if ($ui->gosaUnitTag != "" && isset($config->current['STRICT_UNITS']) &&
+        preg_match('/TRUE/i', $config->current['STRICT_UNITS'])){
+      $filter= "(&(objectClass=posixGroup)(gosaUnitTag=".$ui->gosaUnitTag."))";
+    }
+
     /* Generate group list */
     $ldap->cd($this->config->current['BASE']);
-    $ldap->search("(objectClass=posixGroup)", array("cn", "gidNumber"));
+    $ldap->search("$filter", array("cn", "gidNumber"));
     $this->secondaryGroups[]= "- "._("automatic")." -";
     while ($attrs= $ldap->fetch()){
       $this->secondaryGroups[$attrs['gidNumber'][0]]= $attrs['cn'][0];