diff --git a/gosa-plugins/goto/admin/systems/goto/class_printGeneric.inc b/gosa-plugins/goto/admin/systems/goto/class_printGeneric.inc
index 01c9c349cd0339bcd1d5efc92c97a8d455486e0a..46aa1f1f8b472dda1934e45113d3b409b57a2fcb 100644 (file)
var $gotoPrinterPPD = "";
var $initial_PPD = "";
var $orig_dn = "";
+ var $orig_cn = "";
+ var $orig_base = "";
var $UserMember ="";
var $UserMembers =array();
/* attribute list for save action */
var $attributes = array("cn", "description", "l", "labeledURI", "gotoPrinterPPD","gotoUserPrinter", "macAddress",
- "gotoUserAdminPrinter","gotoGroupAdminPrinter","gotoUserPrinter","gotoGroupPrinter");
+ "gotoUserAdminPrinter","gotoGroupAdminPrinter","gotoUserPrinter","gotoGroupPrinter","gosaUnitTag");
var $objectclasses = array("top", "gotoPrinter");
var $view_logged = FALSE;
var $parent;
/* $this->members contains all members */
$this->member[$type]=array();
- if (isset($this->attrs[$attr]['count'])) {
- unset($this->attrs[$attr]['count']);
- }
-
if(isset($this->attrs[$attr])){
- foreach($this->attrs[$attr] as $mem){
+ $ldap->cd($this->config->current['BASE']) ;
+ for($i = 0 ; $i < $this->attrs[$attr]['count']; $i++){
+
+ $mem = $this->attrs[$attr][$i];
if(preg_match("/Group/",$type)){
- $ldap->search("(&(objectClass=posixGroup)(cn=".$mem."))",array("cn","description"));
+ $ldap->search("(&(|(objectClass=posixGroup)(objectClass=gosaGroupOfNames))(cn=".$mem."))",array("cn","description"));
if($ldap->count()){
$entry = $ldap->fetch();
$this->member[$type][$entry['cn'][0]]=$entry;
}
}
}
+ $this->orig_cn = $this->cn;
+ $this->orig_base = $this->base;
}
function set_acl_base($base)
/* Do we represent a valid printer? */
if (!$this->is_account && $this->parent === NULL){
- $display= "<img alt=\"\" src=\"images/stop.png\" align=middle> <b>".
+ $display= "<img alt=\"\" src=\"images/small-error.png\" align=middle> <b>".
msgPool::noValidExtension(_("printer"))."</b>";
return($display);
}
/* If this is a WS / Terminal depending printer, display account state button */
if(!preg_match("/^Printer$/i",$this->BelongsTo)){
- if((empty($this->cn)) && ($this->dn != "new")){
+ if($this->cn == "" && ($this->dn != "new")){
$display= $this->show_enable_header(_("Add printer extension"),
msgPool::featuresDisabled(_("printer"))._("You can't enable it while 'cn' is not present in entry. Possibly you are currently creating a new terminal template."),TRUE,TRUE);
$this->is_account= false;
/* Parse selected ppd file */
$config = session::get('config');
- if((isset($config->data['MAIN']['PPD_PATH']))&&(is_dir($config->data['MAIN']['PPD_PATH']))){
-
- $path = $config->data['MAIN']['PPD_PATH'];
+ if ($config->get_cfg_value("ppdPath") != ""){
+ $path = $config->get_cfg_value("ppdPath");
if(!preg_match("/\/$/",$path)){
$path = $path."/";
}
$dn= "cn=".$this->cn.get_ou('printerou').",".$this->base;
/* must: cn */
- if(($this->BelongsTo == "Printer") && (empty($this->cn))){
+ if(($this->BelongsTo == "Printer") && $this->cn == ""){
$message[]= msgPool::required(_("Name"));
}
}
}
+ /* Check if we are allowed to create or move this object
+ */
+ if($this->orig_dn == "new" && !$this->acl_is_createable($this->base)){
+ $message[] = msgPool::permCreate();
+ }elseif($this->orig_dn != "new" && $this->base != $this->orig_base && !$this->acl_is_moveable($this->base)){
+ $message[] = msgPool::permMove();
+ }
+
return ($message);
}
if($this->parent->by_object['workgeneric']->cn == "wdefault"){
return;
}
+
+ /* Adapt IP & mac from parent object */
+ $this->netConfigDNS->ipHostNumber = $this->parent->by_object['workgeneric']->netConfigDNS->ipHostNumber;
+ $this->netConfigDNS->macAddress = $this->parent->by_object['workgeneric']->netConfigDNS->macAddress;
+
}elseif(isset($this->parent->by_object['termgeneric'])){
if($this->parent->by_object['termgeneric']->cn == "default"){
return;
}
+
+ /* Adapt IP & mac from parent object */
+ $this->netConfigDNS->ipHostNumber = $this->parent->by_object['termgeneric']->netConfigDNS->ipHostNumber;
+ $this->netConfigDNS->macAddress = $this->parent->by_object['termgeneric']->netConfigDNS->macAddress;
}
/* If type is still unknown, the initialisation of this printer failed, abort. */
}else{
$method="http://";
}
+
+ /* Get servername */
+ $server = $_SERVER['SERVER_NAME'];
+ if(tests::is_ip($server)){
+ $server_name = gethostbyaddr($server);
+ }else{
+ $server_name = gethostbyaddr(gethostbyname($server));
+ }
/* If no ppd is selected, remove this attribute */
if(!empty($this->gotoPrinterPPD) && $this->initially_was_account) {
- $this->gotoPrinterPPD = $method.str_replace("//","/",$_SERVER['SERVER_NAME']."/ppd/".$this->gotoPrinterPPD);
+ $this->gotoPrinterPPD = $method.str_replace("//","/",$server_name."/ppd/".$this->gotoPrinterPPD);
}else{
$this->gotoPrinterPPD = array();
}
$dn= $this->dn;
- plugin::save();
- $ldap= $this->config->get_ldap_link();
/* reduce objectClasses to minimun */
$this->attrs['objectClass']= $this->objectclasses;
+ plugin::save();
+ $ldap= $this->config->get_ldap_link();
+
/* Remove all empty values */
if ($this->orig_dn == 'new'){
$attrs= array();
msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, 0, get_class()));
}
- if(preg_match("/printer/i",$this->BelongsTo)){
+ #if(preg_match("/printer/i",$this->BelongsTo)){
$this->netConfigDNS->cn = $this->cn;
$this->netConfigDNS->dn = $this->dn;
$this->netConfigDNS->save();
- }
+ #}
}
function generateList(){
{
$types = array("AddUser","AddGroup","AddAdminUser","AddAdminGroup");
if(!in_array_ics($type, $types)){
- msg_dialog::display(_("Internal error"), sprintf(_("Illegal member type type '%s'!"), $type), ERROR_DIALOG);
+ msg_dialog::display(_("Internal error"), sprintf(_("Illegal member type '%s'!"), $type), ERROR_DIALOG);
return(FALSE);
}