diff --git a/plugins/admin/systems/class_printGeneric.inc b/plugins/admin/systems/class_printGeneric.inc
index dd7cf2e30bf8b2035252c405160e13a04415fc24..3738b4f4ac4b377b78588a0cbe85d81e43da65ba 100644 (file)
}
$this->orig_dn = $this->dn;
}
$this->orig_dn = $this->dn;
+ $ui= get_userinfo();
/* Get printer settings, possibly dn has changed */
plugin::plugin ($config, $this->dn);
/* Get printer settings, possibly dn has changed */
plugin::plugin ($config, $this->dn);
/* Set base */
if ($this->dn == "new"){
/* Set base */
if ($this->dn == "new"){
- $ui= get_userinfo();
$this->base= dn2base($ui->dn);
$this->cn= "";
} else {
$this->base= dn2base($ui->dn);
$this->cn= "";
} else {
unset($this->attrs[$attr]['count']);
}
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)){
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{
}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;
+ }
}
}
}
}
}
}
$smarty->assign("AdminMember" ,$this->AdminMember);
$smarty->assign("AdminMembers" ,$adminlist);
$smarty->assign("AdminMemberKeys",array_flip($adminlist));
$smarty->assign("AdminMember" ,$this->AdminMember);
$smarty->assign("AdminMembers" ,$adminlist);
$smarty->assign("AdminMemberKeys",array_flip($adminlist));
- $smarty->assign("netconfig", $this->netConfigDNS->execute());
+ if($this->BelongsTo == "Printer"){
+ $smarty->assign("netconfig", $this->netConfigDNS->execute());
+ } else {
+ $smarty->assign("netconfig", "");
+ }
return($display.$smarty->fetch (get_template_path('printer.tpl', TRUE)));
}
return($display.$smarty->fetch (get_template_path('printer.tpl', TRUE)));
}
{
/* Call common method to give check the hook */
$message= plugin::check();
{
/* Call common method to give check the hook */
$message= plugin::check();
- $message= array_merge($message, $this->netConfigDNS->check());
+ if ($this->BelongsTo == 'printer'){
+ $message= array_merge($message, $this->netConfigDNS->check());
+ }
/* Don't display check messages if this is a template object */
if(isset($this->parent->by_object['workgeneric'])){
/* Don't display check messages if this is a template object */
if(isset($this->parent->by_object['workgeneric'])){
if(($this->BelongsTo == "Printer") && (empty($this->cn))){
$message[]= "The required field 'Printer name' is not set.";
}
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)){
/* must: labeledURI */
if(empty($this->labeledURI)){
if($this->BelongsTo == "Workstation"){
$this->dn= preg_replace("/ou=workstations,/","ou=printers,",$this->dn);
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;
}
if(!$this->is_account) return;
$this->PPDdialogToSave->save_ppd();
}
$this->PPDdialogToSave->save_ppd();
}
+ if(preg_match("/https/i",$_SERVER['HTTP_REFERER'])){
+ $method="https://";
+ }else{
+ $method="http://";
+ }
+
+ /* If no ppd is selected, remove this attribute */
+ if(!empty($this->gotoPrinterPPD)) {
+ $this->gotoPrinterPPD = $method.str_replace("//","/",$_SERVER['SERVER_NAME']."/ppd/".$this->gotoPrinterPPD);
+ }else{
+ $this->gotoPrinterPPD = array();
+ }
+
$dn= $this->dn;
plugin::save();
$ldap= $this->config->get_ldap_link();
$dn= $this->dn;
plugin::save();
$ldap= $this->config->get_ldap_link();
$this->attrs= $attrs;
}
$this->attrs= $attrs;
}
- if(preg_match("/https/i",$_SERVER['HTTP_REFERER'])){
- $method="https://";
- }else{
- $method="http://";
- }
-
- $this->attrs['gotoPrinterPPD'] = $method.str_replace("//","/",$_SERVER['SERVER_NAME']."/ppd/".$this->gotoPrinterPPD);
-
/* Append printer user
*/
$this->attrs['gotoUserPrinter']=array();
/* Append printer user
*/
$this->attrs['gotoUserPrinter']=array();
$this->attrs['objectClass'][] = "gosaAdministrativeUnitTag";
}
$this->attrs['objectClass'][] = "gosaAdministrativeUnitTag";
}
+ if($this->orig_dn == 'new'){
+ foreach(array("gotoGroupPrinter","gotoUserAdminPrinter","gotoGroupAdminPrinter","gotoUserPrinter") as $checkVar){
+ if(count($this->attrs[$checkVar]) == 0 || empty($this->attrs[$checkVar])){
+ unset($this->attrs[$checkVar]);
+ }
+ }
+ }
+
/* Write back to ldap */
$ldap= $this->config->get_ldap_link();
if ($this->orig_dn == 'new'){
/* Write back to ldap */
$ldap= $this->config->get_ldap_link();
if ($this->orig_dn == 'new'){
}
show_ldap_error($ldap->get_error(), _("Saving printer failed"));
}
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->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(){
}
function generateList(){