diff --git a/plugins/admin/systems/class_printGeneric.inc b/plugins/admin/systems/class_printGeneric.inc
index 301a9d21bdb0e24560d7a66b3e3355064583ffa5..cc57c88fad2638ebd49c0f83a1ec0b2a62be2866 100644 (file)
}
$this->orig_dn = $this->dn;
+ $ui= get_userinfo();
/* Get printer settings, possibly dn has changed */
plugin::plugin ($config, $this->dn);
/* Set base */
if ($this->dn == "new"){
- $ui= get_userinfo();
$this->base= dn2base($ui->dn);
$this->cn= "";
} else {
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"));
- $entry = $ldap->fetch();
- $this->member[$type][$entry['cn'][0]]=$entry;
+ $ldap->search("(&(objectClass=posixGroup)$tag(cn=".$mem."))",array("cn","description"));
+ if($ldap->count()){
+ $entry = $ldap->fetch();
+ if(isset($entry['cn'])){
+ $this->member[$type][$entry['cn'][0]]=$entry;
+ }
+ }
}else{
- $ldap->search("(&(objectClass=person)(objectClass=inetOrgPerson)(uid=".$mem."))",array("cn","uid"));
- $entry = $ldap->fetch();
- if(isset($entry['uid'])){
- $this->member[$type][$entry['uid'][0]]=$entry;
+ $ldap->search("(&(objectClass=person)$tag(objectClass=inetOrgPerson)(uid=".$mem."))",array("cn","uid"));
+ if($ldap->count()){
+ $entry = $ldap->fetch();
+ if(isset($entry['uid'])){
+ $this->member[$type][$entry['uid'][0]]=$entry;
+ }
}
}
}
if(($this->BelongsTo == "Printer") && (empty($this->cn))){
$message[]= "The required field 'Printer name' is not set.";
}
+
+ if($this->BelongsTo == "Printer"){
+ $ui= get_userinfo();
+ $acl= get_permissions ($dn, $ui->subtreeACL);
+ $acl= get_module_permission($acl, "printer", $this->dn);
+ if (chkacl($acl, "create") != ""){
+ $message[]= _("You have no permissions to create a printer on this 'Base'.");
+ }
+ }
+
/* must: labeledURI */
if(empty($this->labeledURI)){
if($this->BelongsTo == "Workstation"){
$this->dn= preg_replace("/ou=workstations,/","ou=printers,",$this->dn);
+ $mac = $this->parent->by_object['workgeneric']->netConfigDNS->macAddress;
+ $this->netConfigDNS->macAddress = $mac;
}
if(!$this->is_account) return;
}else{
$method="http://";
}
-
- $this->attrs['gotoPrinterPPD'] = $method.str_replace("//","/",$_SERVER['SERVER_NAME']."/ppd/".$this->gotoPrinterPPD);
+
+ /* Only save ppd path, if the path is not empty (no ppd selected )*/
+ if(!empty($this->gotoPrinterPPD)) {
+ $this->attrs['gotoPrinterPPD'] = $method.str_replace("//","/",$_SERVER['SERVER_NAME']."/ppd/".$this->gotoPrinterPPD);
+ }else{
+ $this->attrs['gotoPrinterPPD'] = array();
+ }
+
/* Append printer user
*/
}
show_ldap_error($ldap->get_error(), _("Saving printer failed"));
+
$this->netConfigDNS->cn = $this->cn;
$this->netConfigDNS->dn = $this->dn;
$this->netConfigDNS->save($this->dn);
/* Optionally execute a command after we're done */
$this->postcreate();
+
+ /* This is a multi object. Handle tagging here... */
+ $this->handle_object_tagging();
}
function generateList(){