diff --git a/gosa-plugins/goto/admin/systems/goto/class_workstationService.inc b/gosa-plugins/goto/admin/systems/goto/class_workstationService.inc
index 6d3809e42d1a845ffd70f47f60a038281b2fdee3..d10108a2ae59c8cf9ed5642d0afe16f42ac7e17d 100644 (file)
class workservice extends plugin
{
- /* CLI vars */
- var $cli_summary= "Manage terminal service aspects";
- var $cli_description= "Some longer text\nfor help";
- var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
var $gotoScannerEnable;
/* Generic terminal attributes */
var $gotoXMonitor= "";
$this->orig_dn= $this->dn;
-
-
-
-
-
-
-
-
-
/* Load phone hardware list
*/
- $ldap= $this->config->get_ldap_link();
- $deps = array();
- $ou = preg_replace("/,.*$/","",get_ou("phoneou"));
- if(!empty($ou)){
- $ldap->cd($this->config->current['BASE']);
- $ldap->search("(&(objectClass=organizationalUnit)(".$ou."))",array("dn"));
- while($attrs = $ldap->fetch()){
- $deps[] = $attrs['dn'];
- }
- }else{
-
- /* Phone ou seems to be empty, fall back to overall base .
- */
- $deps[] = $this->config->current['BASE'];
- }
- foreach($deps as $dep){
- $ldap->cd($dep);
- $ldap->search("(objectClass=goFonHardware)", array('cn', 'description'));
- while ($attrs= $ldap->fetch()){
- $cn= $attrs['cn'][0];
- if (isset($attrs['description'])){
- $description= " - ".$attrs['description'][0];
- } else {
- $description= "";
- }
- $this->hardware_list[$cn]= "$cn$description";
+ $tmp = get_sub_list("(objectClass=goFonHardware)","",array(get_ou("phoneou")),
+ $this->config->current['BASE'],array("cn","description"), GL_NO_ACL_CHECK);
+ foreach($tmp as $attrs){
+ $cn= $attrs['cn'][0];
+ $description= "";
+ if (isset($attrs['description'])){
+ $description= " - ".$attrs['description'][0];
}
+ $this->hardware_list[$cn]= "$cn$description";
}
+ $this->hardware_list["automatic"]= _("automatic");
+ ksort($this->hardware_list);
-
-
- /* Eventually colorize phones */
- $deps = array();
- $ou = preg_replace("/,.*$/","",get_ou("systemsou"));
- $deps_a = array(get_ou("ogroupou"),
- get_ou("serverou"),
- get_ou("terminalou"),
- get_ou("workstationou"),
- get_ou("printerou"),
- get_ou("componentou"),
- get_ou("phoneou"));
- if(!empty($ou)){
- $ldap->cd($this->config->current['BASE']);
- $ldap->search("(&(objectClass=organizationalUnit)(".$ou."))",array("dn"));
- while($attrs = $ldap->fetch()){
- foreach($deps_a as $allowed){
- $to_add = preg_replace("/".get_ou('systemsou')."$/","",$allowed);
- $deps[] = $to_add.$attrs['dn'];
- }
- }
- }else{
-
- /* Phone ou seems to be empty, fall back to overall base .
- */
- $deps[] = $this->config->current['BASE'];
- }
-
- foreach($deps as $dep){
- $ldap->cd($dep);
- $ldap->search("(goFonHardware=*)",array('cn','dn','goFonHardware'));
- while($attrs = $ldap->fetch()){
- $cn = $attrs['goFonHardware'][0];
- if(isset($this->hardware_list[$cn])){
- $this->used_hardware[$cn]= $cn;
- }
+ /* These departments may contain objects that have
+ goFonHardware set.
+ */
+ $deps_a = array(
+ get_people_ou(),
+ get_ou("ogroupou"),
+ get_ou("serverou"),
+ get_ou("terminalou"),
+ get_ou("workstationou"),
+ get_ou("printerou"),
+ get_ou("componentou"),
+ get_ou("phoneou"));
+
+ $tmp = get_sub_list("(goFonHardware=*)","",$deps_a,$this->config->current['BASE'],
+ array('cn','dn','goFonHardware'),GL_NO_ACL_CHECK);
+ foreach($tmp as $attrs){
+ $cn = $attrs['goFonHardware'][0];
+ if(isset($this->hardware_list[$cn])){
+ $this->used_hardware[$cn]= $cn;
}
}
- $this->hardware_list["automatic"]= _("automatic");
- ksort($this->hardware_list);
if(preg_match("/\+/",$this->gotoXHsync)){
$this->AutoSync = true;
$this->cleanup();
$ldap->modify ($this->attrs);
new log("modify","workstation/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
- show_ldap_error($ldap->get_error(), sprintf(_("Saving of system workstation/service with dn '%s' failed."),$this->dn));
+ if (!$ldap->success()){
+ msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, LDAP_MOD, get_class()));
+ }
$this->handle_post_events("modify");
}