X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;ds=sidebyside;f=gosa-plugins%2Fgoto%2Fpersonal%2Fenvironment%2Fclass_environment.inc;h=0060589ccb171c36352511dd3903f6b9149d12cb;hb=ed50da6c7499d4e1d9fe051c0b08eb7a1dfc62ba;hp=01df57a8bc608be848ac807003cfde2a9cf3ebec;hpb=d5de7346ec39576aa7523ebd5c3281d89f25791e;p=gosa.git diff --git a/gosa-plugins/goto/personal/environment/class_environment.inc b/gosa-plugins/goto/personal/environment/class_environment.inc index 01df57a8b..0060589cc 100644 --- a/gosa-plugins/goto/personal/environment/class_environment.inc +++ b/gosa-plugins/goto/personal/environment/class_environment.inc @@ -2,10 +2,7 @@ class environment extends plugin { - /* CLI vars */ - var $cli_summary = "Manage server basic objects"; - var $cli_description = "Some longer text\nfor help"; - var $cli_parameters = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser"); + var $plIcon = "plugins/goto/images/plugin.png"; /* attribute list for save action */ var $ignore_account = FALSE; @@ -18,7 +15,7 @@ class environment extends plugin var $is_group = false; var $view_logged = FALSE; - + /* Attribute definition */ @@ -71,9 +68,9 @@ class environment extends plugin var $attributes = array("uid","gotoProfileServer","gotoProfileFlags","gotoHotplugDeviceDN", "gotoXResolution","gotoProfileQuota", - "gotoLogonScripts","gotoLogonScript", + "gotoLogonScript", "gotoPrinter", "gosaDefaultPrinter", - "gotoShares","gotoShare", + "gotoShare", "gotoKioskProfile"); var $objectclasses = array("gotoEnvironment"); // Specifies the objectClass which contains the attributes edited here var $cn; @@ -150,7 +147,7 @@ class environment extends plugin unset($this->attrs['gotoLogonScript']['count']); foreach($this->attrs['gotoLogonScript'] as $device){ $tmp = $tmp2 = array(); - $tmp = split("\|",$device); + $tmp = explode("|",$device); $tmp2['LogonName'] = $tmp[0]; $tmp2['LogonPriority'] = $tmp[2]; if(preg_match("/O/i",$tmp[1])){ @@ -174,7 +171,7 @@ class environment extends plugin unset($this->attrs['gotoShare']['count']); foreach($this->attrs['gotoShare'] as $share){ $tmp = $tmp2 = array(); - $tmp = split("\|",$share); + $tmp = explode("|",$share); $tmp2['server'] =$tmp[0]; $tmp2['name'] =$tmp[1]; @@ -220,12 +217,12 @@ class environment extends plugin "1280x768" => "1280x768", "1280x1024" => "1280x1024"); - if(isset($this->config->data['MAIN']['RESOLUTION_HOOK'])){ - $file = $this->config->data['MAIN']['RESOLUTION_HOOK']; + if($this->config->get_cfg_value("resolutions") != ""){ + $file = $this->config->get_cfg_value("resolutions"); if(is_readable($file)){ $str = file_get_contents($file); - $lines = split("\n",$str); + $lines = preg_split("/\n/",$str); foreach($lines as $line){ $line = trim($line); if(!empty($line)){ @@ -241,26 +238,55 @@ class environment extends plugin $this->gotoProfileServers= $config->getShareServerList() ; $this->gotoShareSelections= $config->getShareList(true); $this->gotoAvailableShares= $config->getShareList(false); + + /* Ensure that a currently selected server will stay selected, even if the list of profile servers + is empty due to insufficient permissions. + */ + if(count($this->gotoProfileServers) && !empty($this->gotoProfileServer)){ + + /* The currently selected profile server is outdated/no longer available */ + if(!isset($this->gotoProfileServers[$this->gotoProfileServer])){ + }else{ + $c = $this->gotoProfileServers[$this->gotoProfileServer]; + if(!preg_match("/r/",$c['ACL'])){ + + /* We are not allowed to read to currently selected server. + But to ensure that the selection will be kept after saving the account, we + override the current ACL tag. + */ + $this->gotoProfileServers[$this->gotoProfileServer]['ACL'] .= "r"; + } + } + } $this->update_kiosk_profiles(); } function update_kiosk_profiles() { + $this->gotoKioskProfile_Server = preg_replace("/^.*:\/\/([^\/]*).*$/","\\1",$this->gotoKioskProfile); + $this->gotoKioskProfile_Profile= preg_replace("/^.*\//","",$this->gotoKioskProfile); + $tmp1 = array("none" => array(_("disabled"))); $tmp2 = array("none" => _("disabled")); + $tmp3 = array(); $ldap = $this->config->get_ldap_link(); $ldap->cd($this->config->current['BASE']); $ldap->search("(&(objectClass=goEnvironmentServer)(gotoKioskProfile=*)(cn=*))",array("cn","gotoKioskProfile")); $cnt = 0; + $ui = get_userinfo(); while($attrs = $ldap->fetch()){ + $acl = $ui->get_permissions($attrs['dn'],"server/goKioskService",""); for($i = 0 ; $i < $attrs['gotoKioskProfile']['count'] ; $i ++){ - $name = preg_replace("/^.*\//","",$attrs['gotoKioskProfile'][$i]); - $tmp1[$attrs['cn'][0]][] = $name; + if(preg_match("/r/",$acl) || $this->gotoKioskProfile_Server == $attrs['cn'][0]){ + $name = preg_replace("/^.*\//","",$attrs['gotoKioskProfile'][$i]); + $tmp1[$attrs['cn'][0]][] = $name; + $tmp3[$attrs['cn'][0]][$name] = $attrs['gotoKioskProfile'][$i]; + $tmp2[$attrs['cn'][0]]= $attrs['cn'][0]; + $cnt ++; + } } - $tmp2[$attrs['cn'][0]]= $attrs['cn'][0]; - $cnt ++; } if($cnt && $this->config->search("environment","kioskpath",array('menu','tabs'))){ @@ -269,24 +295,21 @@ class environment extends plugin $this->gotoKioskProfiles['BY_SERVER'] = $tmp1; $this->gotoKioskProfiles['SERVERS'] = $tmp2; + $this->gotoKioskProfiles['MAP'] = $tmp3; - $this->gotoKioskProfile_Server = preg_replace("/^.*:\/\/([^\/]*).*$/","\\1",$this->gotoKioskProfile); - $this->gotoKioskProfile_Profile= preg_replace("/^.*\//","",$this->gotoKioskProfile); - $error = false; - if(!in_array($this->gotoKioskProfile_Server, $this->gotoKioskProfiles['SERVERS'])){ - $this->gotoKioskProfile_Server = key($this->gotoKioskProfiles['SERVERS']); + if(!isset($this->gotoKioskProfiles['SERVERS'][$this->gotoKioskProfile_Server])){ $error = true; - } - - if(!in_array($this->gotoKioskProfile_Profile, $this->gotoKioskProfiles['BY_SERVER'][$this->gotoKioskProfile_Server])){ - $this->gotoKioskProfile_Profile = $this->gotoKioskProfiles['BY_SERVER'][$this->gotoKioskProfile_Server][0]; + }elseif(!in_array($this->gotoKioskProfile_Profile, $this->gotoKioskProfiles['BY_SERVER'][$this->gotoKioskProfile_Server])){ $error = true; } if($error && !empty($this->gotoKioskProfile)){ + msg_dialog::display(_("Warning"), sprintf(_("Kiosk profile '%s' located on server '%s' is not available anymore. Kiosk profile will be disabled!"), $this->gotoKioskProfile_Profile, $this->gotoKioskProfile_Server), WARNING_DIALOG); + $this->gotoKioskProfile_Server ="none"; + $this->gotoKioskProfile_Profile=""; + }elseif(empty($this->gotoKioskProfile)){ $this->gotoKioskProfile_Server ="none"; $this->gotoKioskProfile_Profile=""; - msg_dialog::display(_("Warning"), sprintf(_("Kiosk profile '%s' located on server '%s' is not available anymore. Kiosk profile will be disabled!"), $this->gotoKioskProfile_Profile, $this->gotoKioskProfile_Server), WARNING_DIALOG); } } @@ -319,12 +342,12 @@ class environment extends plugin } } - /* Are we editing from MyAccount and not editing a user */ - $WriteOnly = (!isset($this->parent)|| !$this->parent) && !session::is_set('edit'); - /* Check profile server */ - if($this->acl_is_writeable("gotoProfileServer",$WriteOnly)){ + if($this->acl_is_writeable("gotoProfileServer")){ + if(!empty($this->gotoProfileServer) && !isset($this->gotoProfileServers[$this->gotoProfileServer])){ + + if(count($this->gotoProfileServers)){ /* Get First Profile */ @@ -361,9 +384,11 @@ class environment extends plugin }else{ $smarty->assign($s_attr."CHK"," checked "); } + } - /* Prepare ACL settings*/ - $smarty->assign($s_attr."ACL",$this->getacl($s_attr,$WriteOnly)); + $tmp = $this->plInfo(); + foreach($tmp['plProvidedAcls'] as $val => $desc){ + $smarty->assign("$val"."ACL", $this->getacl($val)); } /* Is accout enabled | are we editing from usermenu or admin menu @@ -404,8 +429,8 @@ class environment extends plugin } /* Group Dialog with enabled environment options */ if ($this->is_account){ - $display= $this->show_enable_header(_("Remove environment extension"), - _("Environment extension enabled. You can disable it by clicking below.")); + $display= $this->show_enable_header(msgPool::removeFeaturesButton(_("Environment")), + msgPool::featuresEnabled(_("Environment"))); } else { /* Environment is disabled @@ -413,14 +438,16 @@ class environment extends plugin environment extensions */ if((isset($this->parent->by_object['group']))||(isset($this->attrs['objectClass']))&&((in_array("posixAccount",$this->attrs['objectClass'])))){ - // 4. There is a PosixAccount - $display= $this->show_enable_header(_("Add environment extension"), - _("Environment extension disabled. You can enable it by clicking below.")); + $display= $this->show_enable_header(msgPool::addFeaturesButton(_("Environment")), + msgPool::featuresDisabled(_("Environment"))); + return $display; + }elseif((isset($this->parent->by_object['ogroup']))){ + $display= $this->show_enable_header(msgPool::addFeaturesButton(_("Environment")), + msgPool::featuresDisabled(_("Environment"))); return $display; }else{ - // 4. There is no PosixAccount - $display= $this->show_enable_header(_("Add environment extension"), - _("Environment extension disabled. You have to setup a posix account before you can enable this feature.")); + $display= $this->show_enable_header(msgPool::addFeaturesButton(_("Environment")), + msgPool::featuresDisabled(_("Environment"), _("POSIX")), TRUE); return $display; } } @@ -442,19 +469,17 @@ class environment extends plugin // 3. Account enabled . Editing from adminmenu if ($this->is_account){ - $display= $this->show_disable_header(_("Remove environment extension"), - _("Environment extension enabled. You can disable it by clicking below.")); + $display= $this->show_enable_header(msgPool::removeFeaturesButton(_("Environment")), + msgPool::featuresEnabled(_("Environment"))); } else { if($this->parent->by_object['posixAccount']->is_account==true){ - // 4. There is a PosixAccount - $display= $this->show_disable_header(_("Add environment extension"), - _("Environment extension disabled. You can enable it by clicking below.")); + $display= $this->show_enable_header(msgPool::addFeaturesButton(_("Environment")), + msgPool::featuresDisabled(_("Environment"))); return $display; }else{ - // 4. There is a PosixAccount - $display= $this->show_disable_header(_("Add environment extension"), - _("Environment extension disabled. You have to setup a posix account before you can enable this feature."),TRUE,TRUE); + $display= $this->show_enable_header(msgPool::addFeaturesButton(_("Environment")), + msgPool::featuresDisabled(_("Environment"), _("POSIX")), TRUE); return $display; } } @@ -481,16 +506,18 @@ class environment extends plugin }else{ $smarty->assign($s_attr."CHK"," checked "); } + } - /* Prepare ACL settings*/ - $smarty->assign($s_attr."ACL",$this->getacl($s_attr,$WriteOnly)); + $tmp = $this->plInfo(); + foreach($tmp['plProvidedAcls'] as $val => $desc){ + $smarty->assign("$val"."ACL", $this->getacl($val)); } - foreach(array("gotoHotplugDevice","gotoProfileFlagC","gotoProfileFlagL") as $s_attr){ - $smarty->assign($s_attr."ACL",$this->getacl($s_attr,$WriteOnly)); + foreach(array("gotoProfileFlagC","gotoProfileFlagL") as $s_attr){ + $smarty->assign($s_attr."ACL",$this->getacl($s_attr)); } - if($WriteOnly) { + if($this->read_only) { $smarty->assign("gotoPrinterACL","r"); }else{ $smarty->assign("gotoPrinterACL","rw"); @@ -500,15 +527,15 @@ class environment extends plugin $smarty->assign("useProfile",$this->useProfile); if(empty($this->useProfile) && !$this->multiple_support_active){ $smarty->assign("useProfileCHK",""); - $smarty->assign("gotoProfileServerACL" , preg_replace("/w/","",$this->getacl("gotoProfileServer",$WriteOnly))); - $smarty->assign("gotoProfileQuotaACL" , preg_replace("/w/","",$this->getacl("gotoProfileQuota",$WriteOnly))); - $smarty->assign("gotoProfileFlagCACL" , preg_replace("/w/","",$this->getacl("gotoProfileFlagC",$WriteOnly))); + $smarty->assign("gotoProfileServerACL" , preg_replace("/w/","",$this->getacl("gotoProfileServer"))); + $smarty->assign("gotoProfileQuotaACL" , preg_replace("/w/","",$this->getacl("gotoProfileQuota"))); + $smarty->assign("gotoProfileFlagCACL" , preg_replace("/w/","",$this->getacl("gotoProfileFlagC"))); }else{ $smarty->assign("useProfileCHK"," checked "); } - $smarty->assign("gotoProfileServerWriteable", $this->acl_is_writeable("gotoProfileServer",$WriteOnly)); - $smarty->assign("gotoProfileACL", $this->getacl("gotoProfileServer",$WriteOnly).$this->getacl("gotoProfileQuota",$WriteOnly)); + $smarty->assign("gotoProfileServerWriteable", $this->acl_is_writeable("gotoProfileServer")); + $smarty->assign("gotoProfileACL", $this->getacl("gotoProfileServer").$this->getacl("gotoProfileQuota")); /* HANDLE Profile Settings here * Assign available Quota and resolution settings @@ -537,7 +564,6 @@ class environment extends plugin if(!is_array($this->gotoProfileServers)){ $this->gotoProfileServers =array(); } - $smarty->assign("gotoProfileServerKeys",array_flip($this->gotoProfileServers)); /* Handle kiosk profiles*/ $smarty->assign("kiosk_servers" , $this->gotoKioskProfiles['SERVERS']); @@ -555,7 +581,7 @@ class environment extends plugin if(isset($_POST['LogonSave'])){ if(!$this->acl_is_writeable("gotoLogonScript")){ - msg_dialog::display(_("Permission error"), _("You have no permission to modify logon scripts!"), ERROR_DIALOG); + msg_dialog::display(_("Permission error"), msgPool::permModify(_("Logon scripts")), ERROR_DIALOG); unset($this->dialog); $this->dialog=FALSE; $this->is_dialog=false; @@ -645,11 +671,11 @@ class environment extends plugin /* We assign a share to this user, if we don't know where to mount the share */ if(!isset($_POST['gotoShareSelection']) || get_post('gotoShareSelection') == ""){ - msg_dialog::display(_("Error"), _("Please select a valid share!"), ERROR_DIALOG); + msg_dialog::display(_("Error"), msgPool::invalid(_("Share")), ERROR_DIALOG); }elseif((!isset($_POST['gotoShareMountPoint']))||(empty($_POST['gotoShareMountPoint']))||(preg_match("/[\|]/i",$_POST['gotoShareMountPoint']))){ - msg_dialog::display(_("Error"), _("Please specify a valid mount point!"), ERROR_DIALOG); + msg_dialog::display(_("Error"), msgPool::invalid(_("Mount point")), ERROR_DIALOG); }elseif(preg_match('/ /', $_POST['gotoShareMountPoint'])){ - msg_dialog::display(_("Error"), _("You cannot use spaces in the mount path!"), ERROR_DIALOG); + msg_dialog::display(_("Error"), msgPool::invalid(_("Mount point"), "/[^\s]/"), ERROR_DIALOG); }elseif(!( preg_match("/^\//",$_POST['gotoShareMountPoint']) || preg_match("/^~/",$_POST['gotoShareMountPoint']) || @@ -660,7 +686,7 @@ class environment extends plugin preg_match("/^%/",$_POST['gotoShareMountPoint']) ) ){ - msg_dialog::display(_("Error"), _("Please specify a valid mount point!"), ERROR_DIALOG); + msg_dialog::display(_("Error"), msgPool::invalid(_("Mount point")), ERROR_DIALOG); }else{ $a_share = $this->gotoAvailableShares[$_POST['gotoShareSelection']]; $s_mount = $_POST['gotoShareMountPoint']; @@ -716,7 +742,7 @@ class environment extends plugin $tmp = array(); - if($this->acl_is_readable("gotoShares")){ + if($this->acl_is_readable("gotoShare")){ $tmp = $this->printOutAssignedShares(); } @@ -750,7 +776,8 @@ class environment extends plugin /* Create pwd reset images */ if($this->gotoShares[$key]['PwdHash'] != ""){ - $img.= ""; } $field1 = array("string" => "".$value."" , "attach" => "style='".$color."'"); @@ -759,11 +786,12 @@ class environment extends plugin /* Create pwd reset img && delete image */ if($this->gotoShares[$key]['PwdHash'] != ""){ - $img.= ""; $img.= " "; } - $img.= ""; $field1 = array("string" => $value , "attach" => "style='".$color."'"); $field2 = array("string" => $img , "attach" => "style='border-right:0px;'"); @@ -794,41 +822,45 @@ class environment extends plugin foreach($this->gotoHotplugDevices as $plugs){ $tmp[] = $plugs['name']; } - $this->dialog = new hotplugDialog($this->config,$tmp); + $this->dialog = new hotplugSelect($this->config, get_userinfo()); $this->is_dialog = true; } /* Dialog Aborted */ - if(isset($_POST['HotPlugCancel'])){ - unset($this->dialog); + if(isset($_POST['hotplugSelect_cancel'])){ $this->dialog= FALSE; $this->is_dialog = false; } /* Dialod saved */ - if(isset($_POST['HotPlugSave'])){ - - $this->dialog->save_object(); - if(count($this->dialog->check())!=0){ - foreach($this->dialog->check() as $msg){ - msg_dialog::display(_("Error"), $msg, ERROR_DIALOG); - } - }else{ - $this->dialog->save_object(); - $a_tmp = $this->dialog->save(); - - if(is_array($a_tmp)){ - foreach($a_tmp as $name => $hotplug){ - if($this->multiple_support_active){ - $hotplug['UsedByAllUsers'] = TRUE; - } - $this->gotoHotplugDevices[$name]= $hotplug; - } + if(isset($_POST['hotplugSelect_save'])){ + + $res = $this->dialog->save(); + foreach($res as $hotplug){ + $name = $hotplug['cn'][0]; + $entry['dn'] = $hotplug['dn']; + + /* Set class values */ + $tmp = preg_split("/\|/",$hotplug['gotoHotplugDevice'][0]); + $entry['name'] = $hotplug['cn'][0]; + $entry['description'] = $tmp[0]; + $entry['id'] = $tmp[1]; + $entry['produkt'] = $tmp[2]; + $entry['vendor'] = $tmp[3]; + if($this->multiple_support_active){ + $entry['UsedByAllUsers'] = TRUE; } - unset($this->dialog); - $this->dialog= FALSE; - $this->is_dialog = false; + $this->gotoHotplugDevices[$name]= $entry; } + $this->dialog= FALSE; + $this->is_dialog = false; + } + + if($this->dialog instanceOf hotplugSelect){ + + // Build up blocklist + session::set('filterBlacklist', array('cn' => array_keys($this->gotoHotplugDevices))); + return($this->dialog->execute()); } if($this->multiple_support_active){ @@ -847,34 +879,27 @@ class environment extends plugin /* First handle Add Post. Open a dialog that allows us to select a printer or two */ if(isset($_POST['gotoPrinterAdd'])){ - + $this->dialog = new printerSelect($this->config,get_userinfo()); $this->is_dialog=true; - $this->dialog = new selectPrinterDialog($this->config,$this->dn,$this->gotoPrinter); } - if(isset($_POST['PrinterCancel'])){ + if(isset($_POST['printerSelect_cancel']) && $this->dialog instanceOf printerSelect){ $this->is_dialog=false; - unset($this->dialog); $this->dialog=FALSE; } - if(isset($_POST['PrinterSave'])){ - if(count($this->dialog->check())!=0){ - $tmp = $this->dialog->check(); - foreach($tmp as $msg){ - msg_dialog::display(_("Error"), $msg, ERROR_DIALOG); - } - }else{ - $this->dialog->save_object(); - $tmp = $this->dialog->save(); - $tmp2= $this->dialog->getPrinter(true); + if(isset($_POST['printerSelect_save']) && $this->dialog instanceOf printerSelect){ + + $res = $this->dialog->save(); + foreach($res as $printer){ - foreach($tmp as $pname){ - $printerObj = new printtabs($this->config,$this->config->data['TABS']['PRINTTABS'],$tmp2[$pname]['dn'],"printer"); - $printerObj->set_acl_base($tmp2[$pname]['dn']); + $pname = $printer['cn'][0]; + $printerObj = new printtabs($this->config,$this->config->data['TABS']['PRINTTABS'], $printer['dn'],"printer"); + $printerObj->set_acl_base($printer['dn']); $type = false; + if($this->is_group){ if($this->dn == "new"){ $type = "AddGroup"; @@ -894,7 +919,7 @@ class environment extends plugin } if($type){ - $this->gotoPrinter[$pname]=$tmp2[$pname]; + $this->gotoPrinter[$pname]=$printer; $this->gotoPrinter[$pname]['mode']="user"; $this->add_del_printer_member_was_called = true; @@ -908,9 +933,17 @@ class environment extends plugin $this->is_dialog=false; unset($this->dialog); $this->dialog =FALSE; - } } + // Display printer selection dialog + if($this->dialog instanceOf printerSelect){ + + // Build up blocklist + session::set('filterBlacklist',array('cn' => array_keys($this->gotoPrinter))); + return($this->dialog->execute()); + } + + if((isset($_POST['gotoPrinterDel']))&&(isset($_POST['gotoPrinterSel']))&&(!empty($_POST['gotoPrinterSel']))){ $printer = $_POST['gotoPrinterSel']; foreach($printer as $pname){ @@ -969,7 +1002,6 @@ class environment extends plugin } $smarty->assign("gotoPrinter",$this->printOutPrinterDevices()); - $smarty->assign("gotoPrinterKeys",array_flip($this->printOutPrinterDevices())); /* General behavior */ if(is_object($this->dialog)){ @@ -1028,7 +1060,9 @@ class environment extends plugin new log("remove","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); } - show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/environment account with dn '%s' failed."),$this->dn)); + if (!$ldap->success()){ + msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, 0, get_class())); + } /* Optionally execute a command after we're done */ $this->handle_post_events("remove",array("uid" => $this->uid)); @@ -1041,10 +1075,9 @@ class environment extends plugin /* Get all Posted vars * Setup checkboxes */ - $WriteOnly = (!isset($this->parent)|| !$this->parent) && !session::is_set('edit'); if(isset($_POST['iamposted'])){ - $PACL = $this->getacl("gotoProfileServer",$WriteOnly).$this->getacl("gotoProfileQuota",$WriteOnly); + $PACL = $this->getacl("gotoProfileServer").$this->getacl("gotoProfileQuota"); if(isset($_POST['kiosk_server'])){ $tmp = $_POST['kiosk_server']; @@ -1086,7 +1119,7 @@ class environment extends plugin plugin::save_object(); foreach($this->attributes as $s_attr){ if((!isset($_POST[$s_attr])) || - in_array($s_attr,array("gosaDefaultPrinter","gotoShares","gotoHotplugDevices","gotoPrinter","gotoLogonScripts","uid"))) continue; + in_array($s_attr,array("gosaDefaultPrinter","gotoShare","gotoHotplugDevices","gotoPrinter","gotoLogonScripts","uid"))) continue; if(!$this->acl_is_writeable($s_attr)){ continue; }else{ @@ -1110,14 +1143,14 @@ class environment extends plugin $this->detect_grouptype(); if(preg_match("/[^0-9]/",$this->gotoProfileQuota)) { - $message[]=_("Please set a valid profile quota size."); + $message[] = msgPool::invalid(_("Profile quota"),$this->gotoProfileQuota,"/[0-9]/") ; } if(!isset($this->attrs['objectClass'])){ $this->attrs['objectClass']=array(); } if(!$this->is_group){ if((!((in_array("posixAccount",$this->attrs['objectClass']))||($this->parent->by_object['posixAccount']->is_account==true)))&&(!$this->is_group)){ - $message[]=(_("You need to setup a valid posix extension in order to enable evironment features.")); + $message[]= msgPool::featuresDisabled(_("environment"),_("POSIX")); } } return ($message); @@ -1131,11 +1164,7 @@ class environment extends plugin */ /* only save changed variables ....*/ if ($this->gotoKioskProfile_Server != "none"){ - if(preg_match("/https/i",$_SERVER['HTTP_REFERER'])){ - $method="https://".$this->gotoKioskProfile_Server."/kiosk/".$this->gotoKioskProfile_Profile; - }else{ - $method="http://".$this->gotoKioskProfile_Server."/kiosk/".$this->gotoKioskProfile_Profile; - } + $method = $this->gotoKioskProfiles['MAP'][$this->gotoKioskProfile_Server][$this->gotoKioskProfile_Profile]; $this->gotoKioskProfile= $method; }else{ $this->gotoKioskProfile= array(); @@ -1176,6 +1205,7 @@ class environment extends plugin } /* Remove old entries */ + $ldap->cd($this->config->current['BASE']);; $ldap->search("(&(objectClass=gotoPrinter)(goto".$s_suffix."Printer=".$this->$useVar."))",array("*")); while($attr = $ldap->fetch()){ $printerObj = NULL; @@ -1185,6 +1215,7 @@ class environment extends plugin $printerObj->by_object['printgeneric']->save(); } + $ldap->cd($this->config->current['BASE']);; $ldap->search("(&(objectClass=gotoPrinter)(goto".$s_suffix."AdminPrinter=".$this->$useVar."))",array("*")); while($attr = $ldap->fetch()){ $printerObj = NULL; @@ -1214,7 +1245,7 @@ class environment extends plugin /* Prepare HotPlug devices */ $this->attrs['gotoHotplugDeviceDN'] = array(); foreach($this->gotoHotplugDevices as $name => $device){ - $this->attrs['gotoHotplugDeviceDN'][]= $device['dn']; + $this->attrs['gotoHotplugDeviceDN'][]= LDAP::fix($device['dn']); } /* Prepare LogonScripts */ @@ -1285,7 +1316,9 @@ class environment extends plugin new log("create",$cat."/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); } - show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/environment account with dn '%s' failed."),$this->dn)); + if (!$ldap->success()){ + msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, 0, get_class())); + } $this->handle_post_events($mode,array("uid"=>$this->uid)); } @@ -1328,22 +1361,20 @@ class environment extends plugin function printOutPrinterDevices() { $a_return = array(); - - if($this->acl_is_readable("gotoPrinter")){ - if(is_array($this->gotoPrinter)){ - foreach($this->gotoPrinter as $printer){ - if($printer['mode'] == "admin"){ - $a_return[$printer['cn'][0]]= $printer['cn'][0]." - "._("Administrator"); - }else{ - $a_return[$printer['cn'][0]]= $printer['cn'][0]; - } - if ($printer['cn'][0] == $this->gosaDefaultPrinter){ - $a_return[$printer['cn'][0]].=" - "._("Default printer"); - } + if(is_array($this->gotoPrinter)){ + foreach($this->gotoPrinter as $printer){ + if($printer['mode'] == 'admin'){ + $a_return[$printer['cn'][0]]= $printer['cn'][0]." - "._("Administrator"); + }else{ + $a_return[$printer['cn'][0]]= $printer['cn'][0]; + } + if ($printer['cn'][0] == $this->gosaDefaultPrinter){ + $a_return[$printer['cn'][0]].=" - "._("Default printer"); } } } + asort($a_return); return($a_return); } @@ -1402,7 +1433,7 @@ class environment extends plugin unset($this->multi_attrs_all['gotoShare']['count']); foreach($this->multi_attrs_all['gotoShare'] as $share){ $tmp = $tmp2 = array(); - $tmp = split("\|",$share); + $tmp = explode("|",$share); $tmp2['server'] =$tmp[0]; $tmp2['name'] =$tmp[1]; @@ -1433,7 +1464,7 @@ class environment extends plugin unset($this->multi_attrs['gotoShare']['count']); foreach($this->multi_attrs['gotoShare'] as $share){ $tmp = $tmp2 = array(); - $tmp = split("\|",$share); + $tmp = explode("|",$share); $tmp2['server'] =$tmp[0]; $tmp2['name'] =$tmp[1]; @@ -1465,7 +1496,7 @@ class environment extends plugin unset($this->multi_attrs_all['gotoLogonScript']['count']); foreach($this->multi_attrs_all['gotoLogonScript'] as $device){ $tmp = $tmp2 = array(); - $tmp = split("\|",$device); + $tmp = explode("|",$device); $tmp2['LogonName'] = $tmp[0]; $tmp2['LogonPriority'] = $tmp[2]; if(preg_match("/O/i",$tmp[1])){ @@ -1490,7 +1521,7 @@ class environment extends plugin unset($this->multi_attrs['gotoLogonScript']['count']); foreach($this->multi_attrs['gotoLogonScript'] as $device){ $tmp = $tmp2 = array(); - $tmp = split("\|",$device); + $tmp = explode("|",$device); $tmp2['LogonName'] = $tmp[0]; $tmp2['LogonPriority'] = $tmp[2]; if(preg_match("/O/i",$tmp[1])){ @@ -1682,7 +1713,7 @@ class environment extends plugin $this->detect_grouptype(); if(preg_match("/[^0-9]/",$this->gotoProfileQuota) && in_array("gotoProfileQuota",$this->multi_boxes)) { - $message[]=_("Please set a valid profile quota size."); + $message[] = msgPool::invalid(_("Profile quota"),$this->gotoProfileQuota,"/[0-9]/") ; } return($message); } @@ -1750,19 +1781,17 @@ class environment extends plugin "plProvidedAcls" => array( - "gotoProfileFlagL" => _("Resolution changeable during session") , - "gotoProfileFlagC" => _("Cache profile localy") , - - "gotoProfileQuota" => _("Profile quota") , + "gotoPrinter" => _("Printer") , "gotoProfileServer" => _("Profile server") , - - "gotoXResolution" => _("Resolution") , + "gosaDefaultPrinter" => _("Default printer"), + "gotoProfileQuota" => _("Profile quota") , + "gotoProfileFlagC" => _("Cache profile localy") , + "gotoShare" => _("Shares"), + "gotoHotplugDeviceDN" => _("Hotplug devices"), "gotoKioskProfile" => _("Kiosk profile") , - - "gosaDefaultPrinter" => _("Default printer") , - "gotoLogonScript" => _("Logon script") , - "gotoHotplugDevice" => _("Hotplug devices"), - "gotoShare" => _("Shares")) + "gotoProfileFlagL" => _("Resolution changeable during session") , + "gotoXResolution" => _("Resolution") , + "gotoLogonScript" => _("Logon script")) )); } }