From fcca53e341721af298696d91f3cf1a49811bb4fa Mon Sep 17 00:00:00 2001 From: hickert Date: Tue, 23 Jan 2007 08:16:01 +0000 Subject: [PATCH] Updated some plugins. -Fixed incoming handling, was not equal to 2.5 behaviour. -Added ogroup member add, undefined index. -Removed debug output from goFonServer git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@5589 594d385d-05f5-0310-b6e9-bd551577e9d8 --- include/class_ldap.inc | 1 + plugins/admin/ogroups/class_ogroup.inc | 7 +- plugins/admin/systems/class_divListSystem.inc | 8 ++ plugins/admin/systems/class_goFonServer.inc | 1 - plugins/admin/systems/class_servGeneric.inc | 15 +++ .../admin/systems/class_systemManagement.inc | 91 +++++++++++++++---- .../systems/class_workstationGeneric.inc | 4 +- 7 files changed, 102 insertions(+), 25 deletions(-) diff --git a/include/class_ldap.inc b/include/class_ldap.inc index d50b78d55..a93aa96c0 100644 --- a/include/class_ldap.inc +++ b/include/class_ldap.inc @@ -549,6 +549,7 @@ class LDAP{ unset($attr['dn']); if((!in_array("gosaApplication" , $attr['objectClass'])) && (!in_array("gotoMimeType", $attr['objectClass']))){ + $attr['FAIdebianRelease'] = $destinationName; if($type=="branch"){ $attr['FAIstate'] ="branch"; }elseif($type=="freeze"){ diff --git a/plugins/admin/ogroups/class_ogroup.inc b/plugins/admin/ogroups/class_ogroup.inc index 463ee0e2c..bc1012c97 100644 --- a/plugins/admin/ogroups/class_ogroup.inc +++ b/plugins/admin/ogroups/class_ogroup.inc @@ -100,12 +100,15 @@ class ogroup extends plugin function AddDelMembership($NewMember = false){ if($NewMember){ - $this->memberList[$NewMember]= $this->objcache[$NewMember]; + + /* Add member and force reload */ $this->member[$NewMember]= $NewMember; + $this->reload(); + + $this->memberList[$NewMember]= $this->objcache[$NewMember]; unset ($this->objects[$NewMember]); uasort ($this->memberList, 'sort_list'); reset ($this->memberList); - $this->reload(); }else{ /* Delete objects from group */ if (isset($_POST['delete_membership']) && isset($_POST['members'])){ diff --git a/plugins/admin/systems/class_divListSystem.inc b/plugins/admin/systems/class_divListSystem.inc index 488e882f6..7ec5ec944 100644 --- a/plugins/admin/systems/class_divListSystem.inc +++ b/plugins/admin/systems/class_divListSystem.inc @@ -32,6 +32,7 @@ class divListSystem extends MultiSelectWindow "workstation", "terminal", "phone", + "incoming", "printer")); $this->parent = $parent; @@ -231,6 +232,7 @@ class divListSystem extends MultiSelectWindow "printer" => array("CLASS"=>"PRINTTABS", "TABCLASS" =>"printtabs", "ACL"=> "printer/printgeneric"), "phone" => array("CLASS"=>"PHONETABS", "TABCLASS" =>"phonetabs", "ACL"=> "phone/phoneGeneric"), "winstation" => array("CLASS"=>"WINTABS", "TABCLASS" =>"wintabs", "ACL"=> "winworkstation/wingeneric"), + "incoming" => array("CLASS"=>"", "TABCLASS" =>"", "ACL"=> "incoming/systems"), "component" => array("CLASS"=>"COMPONENTTABS","TABCLASS" =>"componenttabs", "ACL"=> "component/componentGeneric")); @@ -246,6 +248,12 @@ class divListSystem extends MultiSelectWindow $acl_type = $type; } + /* Map NewDevice acls to workstation acls */ + if($type == "NewDevice"){ + $type = "incoming"; + $acl_type = "incoming"; + } + /* Get complete category acls */ $acl_all = $ui->has_complete_category_acls($val['dn'],$acl_type) ; diff --git a/plugins/admin/systems/class_goFonServer.inc b/plugins/admin/systems/class_goFonServer.inc index 5f23e2162..b8878786f 100644 --- a/plugins/admin/systems/class_goFonServer.inc +++ b/plugins/admin/systems/class_goFonServer.inc @@ -114,7 +114,6 @@ class goFonServer extends goService{ } } } - return("fa"); } diff --git a/plugins/admin/systems/class_servGeneric.inc b/plugins/admin/systems/class_servGeneric.inc index 9a47614b9..27c454131 100644 --- a/plugins/admin/systems/class_servGeneric.inc +++ b/plugins/admin/systems/class_servGeneric.inc @@ -68,6 +68,21 @@ class servgeneric extends plugin $this->orig_dn= $this->dn; } + + function set_acl_base($base) + { + plugin::set_acl_base($base); + $this->netConfigDNS->set_acl_base($base); + } + + + function set_acl_category($cat) + { + plugin::set_acl_category($cat); + $this->netConfigDNS->set_acl_category($cat); + } + + function execute() { /* Call parent execute */ diff --git a/plugins/admin/systems/class_systemManagement.inc b/plugins/admin/systems/class_systemManagement.inc index ac36a2034..7adac6abc 100644 --- a/plugins/admin/systems/class_systemManagement.inc +++ b/plugins/admin/systems/class_systemManagement.inc @@ -215,6 +215,12 @@ class systems extends plugin /* Create new default terminal * Or create specified object of selected system type, from given incoming object */ + + $save_object_directly = false; + if(($s_action == "SelectedSystemType") && (isset($_POST['ObjectGroup']) && ($_POST['ObjectGroup'] != "none"))){ + $save_object_directly = true; + } + if (isset($_POST['create_system'])||$s_action=="newsystem"||$s_action == "SelectedSystemType") { /* If the current entry is an incoming object @@ -540,22 +546,45 @@ class systems extends plugin } - /******************** - Edit system type finished, check if everything went ok + + + + + + + + /******************** + Edit system type finished, check if everything went ok ********************/ /* Finish user edit is triggered by the tabulator dialog, so the user wants to save edited data. Check and save at this point. */ - if ((isset($_POST['edit_finish']) || isset($_POST['edit_apply'])) && (isset($this->systab->config))){ + if ((isset($_POST['edit_finish'])) && (isset($this->systab->config)) || $save_object_directly){ /* Check tabs, will feed message array */ - $message= $this->systab->check(); + $message = array(); + if(!$save_object_directly){ + $message = $this->systab->check(); + }else{ + $found = false; + + /* Set gotoMode to active if we there was an ogroup selected . (save_object_directly) */ + foreach(array("workgeneric"=>"active","servgeneric"=>"active","termgeneric"=>"graphic") as $tab => $value){ + if(isset($this->systab->by_object[$tab]->gotoMode)) { + $found = true; + $this->systab->by_object[$tab]->gotoMode = $value; + } + } + if(!$found){ + print_red(sprintf(_("Can't set gotoMode to status 'avtice', the current object couldn't be identified."))); + } + } /* Save, or display error message? */ if (count($message) == 0){ /* Save terminal data to ldap */ - if(isset($_SESSION['SelectedSystemType']['ogroup'])){ + if(isset($_SESSION['SelectedSystemType']['ogroup']) && $_SESSION['SelectedSystemType']['ogroup'] != 'none'){ foreach (array("workservice", "termservice") as $cls){ if (isset($this->systab->by_object[$cls])){ $this->systab->by_object[$cls]->gotoXMouseport= ""; @@ -565,15 +594,17 @@ class systems extends plugin } } } + $this->systab->save(); gosa_log ("System object'".$this->dn."' has been saved"); - /* Incoming behavior; you can select a system type and an ogroup membership. + /* Incoming behavior; you can select a system type and an ogroup membership. * If this object is an Incoming object, $_SESSION['SelectedSystemType'] isset. * Check if we must add the new object to an object group. - * - * If this is done, delete the old incoming entry... it is still there, because this is a new + * + * If this is done, delete the old incoming entry... it is still there, because this is a new * entry and not an edited one, so we will delete it. + * */ if(isset($_SESSION['SelectedSystemType'])){ @@ -590,7 +621,7 @@ class systems extends plugin $ldap = $this->config->get_ldap_link(); } $ldap->cd ($this->dn); - $ldap->cat($this->dn, array('dn')); + $ldap->cat($this->dn, array('dn')); if(count($ldap->fetch())){ $ldap->cd($this->dn); $ldap->rmDir($this->dn); @@ -598,17 +629,15 @@ class systems extends plugin $ldap->cd($this->config->current['BASE']); } - if (!isset($_POST['edit_apply'])){ - /* Terminal has been saved successfully, remove lock from - LDAP. */ - if ($this->dn != "new"){ - del_lock ($this->dn); - } - - unset ($this->systab); - $this->systab= NULL; - unset($_SESSION['objectinfo']); + /* Terminal has been saved successfully, remove lock from + LDAP. */ + if ($this->dn != "new"){ + del_lock ($this->dn); } + + unset ($this->systab); + $this->systab= NULL; + unset($_SESSION['objectinfo']); } else { /* Ok. There seem to be errors regarding to the tab data, show message and continue as usual. */ @@ -616,6 +645,7 @@ class systems extends plugin } } + /******************** Edit system was canceled ********************/ @@ -687,6 +717,7 @@ class systems extends plugin $tabs = array( "terminal" => "ou=terminals,ou=systems,", "workstation" => "ou=workstations,ou=systems,", + "incoming" => "ou=incoming,", "server" => "ou=servers,ou=systems,", "printer" => "ou=printers,ou=systems,", "phone" => "ou=phones,ou=systems,", @@ -1048,6 +1079,28 @@ class systems extends plugin return ($type); } + + /* !! Incoming dummy acls, required to defined acls for incoming objects + */ + function plInfo() + { + return (array( + "plShortName" => _("Incoming objects"), + "plDescription" => _("Incoming objects"), + "plSelfModify" => FALSE, + "plDepends" => array(), + "plPriority" => 99, + "plSection" => array("administration"), + "plCategory" => array("incoming" => array( "description" => _("Incoming"), + "objectClass" => "")), + "plProvidedAcls"=> array() + + )); + } + + + + } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: diff --git a/plugins/admin/systems/class_workstationGeneric.inc b/plugins/admin/systems/class_workstationGeneric.inc index 45efd16da..36c9d3eb3 100644 --- a/plugins/admin/systems/class_workstationGeneric.inc +++ b/plugins/admin/systems/class_workstationGeneric.inc @@ -436,7 +436,7 @@ class workgeneric extends plugin /* Strip out 'default' values */ foreach (array("gotoSyslogServer") as $val){ - if ($this->attrs[$val] == "default"){ + if (isset($this->attrs[$val]) && $this->attrs[$val] == "default"){ $this->attrs[$val]= array(); } } @@ -505,8 +505,6 @@ class workgeneric extends plugin } } - print_a($this->attrs); - /* cn=default and macAddress=- indicates that this is a template */ if($this->cn == "wdefault"){ $this->netConfigDNS->macAddress = "-"; -- 2.30.2