From f56bb776ec6e1ddc736c159997828f4e38033c8d Mon Sep 17 00:00:00 2001 From: cajus Date: Wed, 23 Aug 2006 06:20:00 +0000 Subject: [PATCH] Updated tag handling for several lists git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@4501 594d385d-05f5-0310-b6e9-bd551577e9d8 --- include/class_config.inc | 11 ++++++++++- .../admin/applications/class_divListApplication.inc | 2 +- plugins/admin/groups/class_groupGeneric.inc | 11 ++++++++++- plugins/admin/systems/class_printGeneric.inc | 13 ++++++++++--- .../personal/environment/class_hotplugDialog.inc | 9 ++++++++- .../environment/class_selectPrinterDialog.inc | 11 ++++++++++- plugins/personal/posix/class_posixAccount.inc | 10 +++++++++- 7 files changed, 58 insertions(+), 9 deletions(-) diff --git a/include/class_config.inc b/include/class_config.inc index f413ecb62..339eca51f 100644 --- a/include/class_config.inc +++ b/include/class_config.inc @@ -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'])){ diff --git a/plugins/admin/applications/class_divListApplication.inc b/plugins/admin/applications/class_divListApplication.inc index b6f63d044..905629782 100755 --- a/plugins/admin/applications/class_divListApplication.inc +++ b/plugins/admin/applications/class_divListApplication.inc @@ -158,7 +158,7 @@ class divListApplication extends MultiSelectWindow $actions.= ""; if($is_freezed){ - $actions.= " "; + $actions.= " "; }else{ $actions.= ""; diff --git a/plugins/admin/groups/class_groupGeneric.inc b/plugins/admin/groups/class_groupGeneric.inc index 449ee54de..e1a3ca488 100644 --- a/plugins/admin/groups/class_groupGeneric.inc +++ b/plugins/admin/groups/class_groupGeneric.inc @@ -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']){ diff --git a/plugins/admin/systems/class_printGeneric.inc b/plugins/admin/systems/class_printGeneric.inc index 09d5d80eb..8154a89ac 100644 --- a/plugins/admin/systems/class_printGeneric.inc +++ b/plugins/admin/systems/class_printGeneric.inc @@ -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'])){ diff --git a/plugins/personal/environment/class_hotplugDialog.inc b/plugins/personal/environment/class_hotplugDialog.inc index 3a1ca5e84..52b8675c6 100644 --- a/plugins/personal/environment/class_hotplugDialog.inc +++ b/plugins/personal/environment/class_hotplugDialog.inc @@ -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(); diff --git a/plugins/personal/environment/class_selectPrinterDialog.inc b/plugins/personal/environment/class_selectPrinterDialog.inc index 2400b2857..b39588aa7 100644 --- a/plugins/personal/environment/class_selectPrinterDialog.inc +++ b/plugins/personal/environment/class_selectPrinterDialog.inc @@ -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; diff --git a/plugins/personal/posix/class_posixAccount.inc b/plugins/personal/posix/class_posixAccount.inc index 53ef503de..96e1bd796 100644 --- a/plugins/personal/posix/class_posixAccount.inc +++ b/plugins/personal/posix/class_posixAccount.inc @@ -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]; -- 2.30.2