X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=gosa-core%2Fplugins%2Fadmin%2Fogroups%2Fclass_ogroup.inc;h=5c51363c5701aa5c4d97fe80e5319ea3b654dd83;hb=2274d64c94b69218e890419926ba10548cc2d098;hp=5e1dec7ae4113b6f7d64c8df6c33587f1cb3a738;hpb=691ee6d5bc28810c775aa396be6d103880a199e4;p=gosa.git diff --git a/gosa-core/plugins/admin/ogroups/class_ogroup.inc b/gosa-core/plugins/admin/ogroups/class_ogroup.inc index 5e1dec7ae..5c51363c5 100644 --- a/gosa-core/plugins/admin/ogroups/class_ogroup.inc +++ b/gosa-core/plugins/admin/ogroups/class_ogroup.inc @@ -1,5 +1,24 @@ dn == "new"){ $this->base = session::get('CurrentMainBase'); } else { - $this->base= preg_replace("/^[^,]+,".normalizePreg(get_ou("ogroupou"))."/","",$this->dn); + $this->base= preg_replace("/^[^,]+,".preg_quote(get_ou("ogroupRDN"), '/')."/i","",$this->dn); + + /* Is this account a trustAccount? */ + if ($this->is_account && isset($this->attrs['trustModel'])){ + $this->trustModel= $this->attrs['trustModel'][0]; + $this->was_trust_account= TRUE; + } else { + $this->was_trust_account= FALSE; + $this->trustModel= ""; + } + + $this->accessTo = array(); + if ($this->is_account && isset($this->attrs['accessTo'])){ + for ($i= 0; $i<$this->attrs['accessTo']['count']; $i++){ + $tmp= $this->attrs['accessTo'][$i]; + $this->accessTo[$tmp]= $tmp; + } + } + } + + /* Detect all workstations, which are already assigned to an object group + - Those objects will be hidden in the add object dialog. + - Check() will complain if such a system is assigned to this object group. + */ + $base = $this->config->current['BASE']; + $res = get_list("(|(objectClass=gotoWorkstation)(objectClass=gotoTerminal))","none" , + $base, array("dn"),GL_NO_ACL_CHECK|GL_SUBSEARCH); + $ws_dns = array(); + foreach($res as $data){ + $ws_dns[] = $data['dn']; + } + $res=get_list("(&(member=*)(objectClass=gosaGroupOfNames))","none", + $base, array("dn","member", "gosaGroupObjects"),GL_NO_ACL_CHECK|GL_SUBSEARCH); + $this->used_workstations = array(); + foreach($res as $og){ + if($og['dn'] == $this->dn) continue; + $test = array_intersect($ws_dns,$og['member']); + if(($og['gosaGroupObjects'] == "[W]" || $og['gosaGroupObjects'] == "[T]") && count($test)){ + $this->used_workstations = array_merge($this->used_workstations,$test); + } + } + + $this->orig_cn = $this->cn; + $this->orig_base = $this->base; + + /* Get global filter config */ + if (!session::is_set("sysfilter")){ + $ui= get_userinfo(); + $base= get_base_from_people($ui->dn); + $sysfilter= array( "depselect" => $base, + "regex" => "*"); + session::set("sysfilter", $sysfilter); } - /* Load member data */ + /* Instanciate base selector */ + $this->baseSelector= new baseSelector($this->get_allowed_bases(), $this->base); + $this->baseSelector->setSubmitButton(false); + $this->baseSelector->setHeight(300); + $this->baseSelector->update(true); + $this->reload(); } @@ -126,30 +214,46 @@ class ogroup extends plugin } /* Add objects to group */ - if (isset($_POST['add_object_finish']) && isset($_POST['objects'])){ - - $tmp = ""; - foreach($this->memberList as $obj){ - $tmp .= $obj['type']; - } + if (isset($_POST['objectSelect_save']) && $this->objectSelect instanceOf objectSelect){ + $objects = $this->objectSelect->save(); $skipped = FALSE; - foreach ($_POST['objects'] as $value){ - if(preg_match("/T/",$tmp) && $this->objects[$value]['type'] == "W"){ + foreach($objects as $object){ + + $tmp = ""; + foreach($this->memberList as $obj){ + $tmp .= $obj['type']; + } + + $type = $this->getObjectType($object); + $name= $this->getObjectName($object); + $dn = $object['dn']; + + /* Fill array */ + if (isset($object["description"][0])){ + $object= array("text" => "$name [".$object["description"][0]."]", "type" => "$type"); + } elseif (isset($object["uid"][0])) { + $object= array("text" => "$name [".$object["uid"][0]."]", "type" => "$type"); + } else { + $object= array("text" => "$name", "type" => "$type"); + } + + if(preg_match("/T/",$tmp) && $type == "W"){ $skipped =TRUE; - }elseif(preg_match("/W/",$tmp) && $this->objects[$value]['type'] == "T"){ + }elseif(preg_match("/W/",$tmp) && $type == "T"){ $skipped =TRUE; }else{ - $this->memberList["$value"]= $this->objects[$value]; - $this->member["$value"]= $value; - unset ($this->objects[$value]); + + $this->memberList["$dn"]= $object; + $this->member["$dn"]= $dn; uasort ($this->memberList, 'sort_list'); reset ($this->memberList); } } if($skipped){ - print_red(_("You can only have terminals or workstations in one group, but not both.")); + msg_dialog::display(_("Information"), _("You cannot combine terminals and workstations in one object group!"), INFO_DIALOG); } - $this->reload(); + $this->objectSelect= FALSE; + $this->dialog= FALSE; } } } @@ -167,57 +271,76 @@ class ogroup extends plugin /* Do we represent a valid group? */ if (!$this->is_account){ - $display= "\"\" ". - _("This 'dn' is no object group.").""; + $display= "\"\" ". + msgPool::noValidExtension("object group").""; return ($display); } - /* Delete objects from group */ - if (isset($_POST['delete_membership']) && isset($_POST['members'])){ - foreach ($_POST['members'] as $value){ - if(isset($this->memberList[$value])){ - $this->objects["$value"]= $this->memberList[$value]; - unset ($this->memberList["$value"]); - unset ($this->member["$value"]); - uasort ($this->objects, 'sort_list'); - reset ($this->objects); - } - } - $this->reload(); - } - - /* Add objects to group */ - if (isset($_POST['add_object_finish']) && isset($_POST['objects'])){ - foreach ($_POST['objects'] as $value){ - if(isset($this->objects[$value])){ - $this->memberList["$value"]= $this->objects[$value]; - $this->member["$value"]= $value; - unset ($this->objects[$value]); - uasort ($this->memberList, 'sort_list'); - reset ($this->memberList); - } - } - $this->reload(); - } /* Load templating engine */ $smarty= get_smarty(); + $smarty->assign("usePrototype", "true"); $tmp = $this->plInfo(); foreach($tmp['plProvidedAcls'] as $name => $translation){ $smarty->assign($name."ACL",$this->getacl($name)); } - /* Base select dialog */ - $once = true; - foreach($_POST as $name => $value){ - if(preg_match("/^chooseBase/",$name) && $once && $this->acl_is_moveable()){ - $once = false; - $this->dialog = new baseSelectDialog($this->config,$this,$this->get_allowed_bases()); - $this->dialog->setCurrentBase($this->base); + /*********** + * Trusts + ***********/ + + /* Add user workstation? */ + if (isset($_POST["add_ws"])){ + $this->trustSelect= new trustSelect($this->config,get_userinfo()); + $this->dialog= TRUE; + } + + // Add selected machines to trusted ones. + if (isset($_POST["add_ws_finish"]) && $this->trustSelect){ + $trusts = $this->trustSelect->detectPostActions(); + if(isset($trusts['targets'])){ + + $headpage = $this->trustSelect->getHeadpage(); + foreach($trusts['targets'] as $id){ + $attrs = $headpage->getEntry($id); + $this->accessTo[$attrs['cn'][0]]= $attrs['cn'][0]; + } + ksort($this->accessTo); + $this->is_modified= TRUE; + } + $this->trustSelect= NULL; + $this->dialog= FALSE; + } + + + /* Remove user workstations? */ + if (isset($_POST["delete_ws"]) && isset($_POST['workstation_list'])){ + foreach($_POST['workstation_list'] as $name){ + unset ($this->accessTo[$name]); } + $this->is_modified= TRUE; + } + + /* Add user workstation finished? */ + if (isset($_POST["add_ws_cancel"])){ + $this->trustSelect= NULL; + $this->dialog= FALSE; + } + + /* Show ws dialog */ + if ($this->trustSelect){ + + // Build up blocklist + session::set('filterBlacklist', array('cn' => array_values($this->accessTo))); + return($this->trustSelect->execute()); } + /*********** + * Ende - Trusts + ***********/ + + /* Dialog handling */ if(is_object($this->dialog) && $this->acl_is_moveable()){ /* Must be called before save_object */ @@ -240,67 +363,20 @@ class ogroup extends plugin /* Add objects? */ if (isset($_POST["edit_membership"])){ - $this->group_dialog= TRUE; + $this->objectSelect= new objectSelect($this->config, get_userinfo()); $this->dialog= TRUE; } /* Add objects finished? */ - if (isset($_POST["add_object_finish"]) || isset($_POST["add_object_cancel"])){ - $this->group_dialog= FALSE; + if (isset($_POST["objectSelect_cancel"])){ + $this->objectSelect= FALSE; $this->dialog= FALSE; } /* Manage object add dialog */ - if ($this->group_dialog){ - - /* Save data */ - $ogfilter= session::get("ogfilter"); - foreach( array("dselect", "regex") as $type){ - if (isset($_POST[$type])){ - $ogfilter[$type]= $_POST[$type]; - } - } - if (isset($_POST['dselect'])){ - foreach( array("accounts", "groups", "applications", "departments", - "servers", "workstations", "winstations", "terminals", "printers","subtrees", - "phones") as $type){ - - if (isset($_POST[$type])) { - $ogfilter[$type]= "checked"; - } else { - $ogfilter[$type]= ""; - } - } - } - if (isset($_GET['search'])){ - $s= mb_substr($_GET['search'], 0, 1, "UTF8")."*"; - if ($s == "**"){ - $s= "*"; - } - $ogfilter['regex']= $s; - } - session::set("ogfilter", $ogfilter); - $this->reload(); - - /* Calculate actual groups */ - $smarty->assign("objects", $this->convert_list($this->objects)); - - /* Show dialog */ - $smarty->assign("search_image", get_template_path('images/search.png')); - $smarty->assign("launchimage", get_template_path('images/small_filter.png')); - $smarty->assign("tree_image", get_template_path('images/tree.png')); - $smarty->assign("deplist", $this->config->idepartments); - $smarty->assign("alphabet", generate_alphabet()); - foreach( array("dselect", "regex", "accounts", "groups", "applications", - "departments", "servers", "workstations", "winstations", "terminals","subtrees", - "printers", "phones") as $type){ - $smarty->assign("$type", $ogfilter[$type]); - } - $smarty->assign("hint", print_sizelimit_warning()); - $smarty->assign("apply", apply_filter()); - - $display= $smarty->fetch (get_template_path('ogroup_objects.tpl', TRUE, dirname(__FILE__))); - return ($display); + if ($this->objectSelect){ + session::set('filterBlacklist', array('dn'=> $this->member)); + return($this->objectSelect->execute()); } /* Bases / Departments */ @@ -330,7 +406,7 @@ class ogroup extends plugin error_reporting(0); if (isset($type[1]) && preg_match('/[UGADSFOWTP]/', $type[1])){ $p2= $conv[$type[1]]; - $smarty->assign("combinedObjects", "$p1 "._("and")." $p2"); + $smarty->assign("combinedObjects", sprintf("'%s' and '%s'", $p1, $p2)); } else { $smarty->assign("combinedObjects", "$p1"); } @@ -338,8 +414,7 @@ class ogroup extends plugin } /* Assign variables */ - $smarty->assign("bases", $this->get_allowed_bases()); - $smarty->assign("base_select", $this->base); + $smarty->assign("base", $this->baseSelector->render()); $smarty->assign("department", $this->department); $smarty->assign("members", $this->convert_list($this->memberList)); @@ -351,6 +426,39 @@ class ogroup extends plugin $smarty->assign("$val", $this->$val); } + /****** + Trust account + ******/ + $smarty->assign("trusthide", " disabled "); + $smarty->assign("trustmodeACL", $this->getacl("trustModel")); + if ($this->trustModel == "fullaccess"){ + $trustmode= 1; + // pervent double disable tag in html code, this will disturb our clean w3c html + $smarty->assign("trustmode", $this->getacl("trustModel")); + + } elseif ($this->trustModel == "byhost"){ + $trustmode= 2; + $smarty->assign("trusthide", ""); + } else { + // pervent double disable tag in html code, this will disturb our clean w3c html + $smarty->assign("trustmode", $this->getacl("trustModel")); + $trustmode= 0; + } + $smarty->assign("trustmode", $trustmode); + $smarty->assign("trustmodes", array( 0 => _("disabled"), 1 => _("full access"), + 2 => _("allow access to these hosts"))); + + $smarty->assign("workstations", $this->accessTo); + + if((count($this->accessTo))==0){ + $smarty->assign("emptyArrAccess",true); + }else{ + $smarty->assign("emptyArrAccess",false); + } + /****** + Ende - Trust account + ******/ + return ($smarty->fetch (get_template_path('generic.tpl', TRUE))); } @@ -358,23 +466,49 @@ class ogroup extends plugin /* Save data to object */ function save_object() { + /* Refresh base */ + if ($this->acl_is_moveable($this->base)){ + if (!$this->baseSelector->update()) { + msg_dialog::display(_("Error"), msgPool::permMove(), ERROR_DIALOG); + } + if ($this->base != $this->baseSelector->getBase()) { + $this->base= $this->baseSelector->getBase(); + $this->is_modified= TRUE; + } + } + /* Save additional values for possible next step */ if (isset($_POST['ogroupedit'])){ + /****** + Trust account + ******/ + + if($this->acl_is_writeable("trustModel")){ + if (isset($_POST['trustmode'])){ + $saved= $this->trustModel; + if ($_POST['trustmode'] == "1"){ + $this->trustModel= "fullaccess"; + } elseif ($_POST['trustmode'] == "2"){ + $this->trustModel= "byhost"; + } else { + $this->trustModel= ""; + } + if ($this->trustModel != $saved){ + $this->is_modified= TRUE; + } + } + } + /****** + Ende Trust account + ******/ + /* Create a base backup and reset the base directly after calling plugin::save_object(); Base will be set seperatly a few lines below */ $base_tmp = $this->base; plugin::save_object(); $this->base = $base_tmp; - - /* Save base, since this is no LDAP attribute */ - $tmp = $this->get_allowed_bases(); - if(isset($_POST['base'])){ - if(isset($tmp[$_POST['base']])){ - $this->base= $_POST['base']; - } - } } } @@ -402,18 +536,33 @@ class ogroup extends plugin Generate Filter ###########*/ - $p_f= array("accounts" => array("CLASS"=>"gosaAccount" ,"DN"=> get_people_ou() ,"ACL" => "users"), - "groups" => array("CLASS"=>"posixGroup" ,"DN"=> get_groups_ou('ogroupou') ,"ACL" => "groups"), - "applications" => array("CLASS"=>"gosaApplication","DN"=> get_ou('applicationou') ,"ACL" => "application"), - "departments" => array("CLASS"=>"gosaDepartment" ,"DN"=> "" ,"ACL" => "department"), - "servers" => array("CLASS"=>"goServer" ,"DN"=> get_ou('serverou') ,"ACL" => "server"), - "workstations" => array("CLASS"=>"gotoWorkstation","DN"=> get_ou('workstationou') ,"ACL" => "workstation"), - "winstations" => array("CLASS"=>"opsiClient", "DN"=> get_ou('WINSTATIONS') ,"ACL" => "winstation"), - "terminals" => array("CLASS"=>"gotoTerminal" ,"DN"=> get_ou('terminalou') ,"ACL" => "terminal"), - "printers" => array("CLASS"=>"gotoPrinter" ,"DN"=> get_ou('printerou') ,"ACL" => "printer"), - "phones" => array("CLASS"=>"goFonHardware" ,"DN"=> get_ou('phoneou') ,"ACL" => "phone")); - - + $p_f= array("accounts"=> array("OBJ"=>"user", "CLASS"=>"gosaAccount" , + "DN"=> get_people_ou() ,"ACL" => "users"), + "groups" => array("OBJ"=>"group", "CLASS"=>"posixGroup" , + "DN"=> get_groups_ou('ogroupRDN') ,"ACL" => "groups"), + "departments" => array("OBJ"=>"department", "CLASS"=>"gosaDepartment" , + "DN"=> "" ,"ACL" => "department"), + "servers" => array("OBJ"=>"servgeneric", "CLASS"=>"goServer" , + "DN"=> get_ou('serverRDN') ,"ACL" => "server"), + "workstations" => array("OBJ"=>"workgeneric", "CLASS"=>"gotoWorkstation", + "DN"=> get_ou('workstationRDN') ,"ACL" => "workstation"), + "winstations" => array("OBJ"=>"wingeneric", "CLASS"=>"opsiClient", + "DN"=> get_ou('SAMBAMACHINEACCOUNTRDN') ,"ACL" => "winstation"), + "terminals" => array("OBJ"=>"termgeneric", "CLASS"=>"gotoTerminal" , + "DN"=> get_ou('terminalRDN') ,"ACL" => "terminal"), + "printers" => array("OBJ"=>"printgeneric", "CLASS"=>"gotoPrinter" , + "DN"=> get_ou('printerRDN') ,"ACL" => "printer"), + "phones" => array("OBJ"=>"phoneGeneric", "CLASS"=>"goFonHardware" , + "DN"=> get_ou('phoneRDN') ,"ACL" => "phone")); + + + /* Allow searching for applications, if we are not using release managed applications + */ + if(!$this->IsReleaseManagementActivated()){ + $p_f[ "applications"] = array("OBJ"=>"application", "CLASS"=>"gosaApplication", + "DN"=> get_ou('applicationRDN') ,"ACL" => "application"); + } + /*########### Perform search for selected objectClasses & regex to fill list with objects ###########*/ @@ -425,14 +574,15 @@ class ogroup extends plugin foreach($p_f as $post_name => $data){ - if($ogfilter[$post_name] == "checked"){ + if($ogfilter[$post_name] == "checked" && class_available($data['OBJ'])){ if($ogfilter['subtrees']){ $base = $ogfilter['dselect']; }else{ $base = $data['DN'].$ogfilter['dselect']; } - + + $filter = "(&(objectClass=".$data['CLASS'].")(|(uid=$regex)(cn=$regex)(ou=$regex)))"; $res = get_list($filter, $data['ACL'] , $base, array("description", "objectClass", "sn", "givenName", "uid","ou","cn"),$Get_list_flags); @@ -440,6 +590,14 @@ class ogroup extends plugin /* fetch results and append them to the list */ foreach($res as $attrs){ + /* Skip workstations which are already assigned to an object group. + */ + if ($this->gosaGroupObjects == "[W]" || $this->gosaGroupObjects == "[T]"){ + if(in_array($attrs['dn'],$this->used_workstations)){ + continue; + } + } + $type= $this->getObjectType($attrs); $name= $this->getObjectName($attrs); @@ -471,11 +629,11 @@ class ogroup extends plugin it seams that this entry was removed */ /* Try to resolv the entry again, if it still fails, display error msg */ - $ldap->cat($dn, array("cn", "sn", "givenName", "ou", "description", "objectClass")); + $ldap->cat($dn, array("cn", "sn", "givenName", "ou", "description", "objectClass", "macAddress")); /* It has failed, add entry with type flag I (Invalid)*/ - if ($ldap->error != "Success"){ - $this->memberList[$dn]= array('text' => _("Non existing dn:")." ".@LDAP::fix($dn),"type" => "I"); + if (!$ldap->success()){ + $this->memberList[$dn]= array('text' => _("Non existing dn:")." ".LDAP::fix($dn),"type" => "I"); } else { @@ -495,6 +653,13 @@ class ogroup extends plugin $this->objcache[$attrs["dn"]]= array("text" => "$name", "type" => "$type"); } $this->objcache[$attrs["dn"]]['objectClass'] = $attrs['objectClass']; + + if(isset($attrs['macAddress'][0])){ + $this->objcache[$attrs["dn"]]['macAddress'] = $attrs['macAddress'][0]; + }else{ + $this->objcache[$attrs["dn"]]['macAddress'] = ""; + } + if(isset($attrs['uid'])){ $this->objcache[$attrs["dn"]]['uid'] = $attrs['uid']; } @@ -533,21 +698,23 @@ class ogroup extends plugin function convert_list($input) { $temp= ""; - $conv= array( "U" => "select_user.png", - "G" => "select_groups.png", - "A" => "select_application.png", - "D" => "select_department.png", - "S" => "select_server.png", - "W" => "select_workstation.png", - "O" => "select_winstation.png", - "T" => "select_terminal.png", - "F" => "select_phone.png", - "I" => "flag.png", - "P" => "select_printer.png"); + $conv= array( + "Y" => "plugins/users/images/select_template.png", + "U" => "plugins/generic/images/head.png", + "G" => "plugins/groups/images/groups.png", + "A" => "plugins/ogroups/images/application.png", + "D" => "plugins/departments/images/department.png", + "S" => "plugins/ogroups/images/server.png", + "W" => "plugins/ogroups/images/workstation.png", + "O" => "plugins/ogroups/images/winstation.png", + "T" => "plugins/ogroups/images/terminal.png", + "F" => "plugins/ogroups/images/phone.png", + "P" => "plugins/ogroups/images/printer.png", + "I" => "images/false.png"); foreach ($input as $key => $value){ /* Generate output */ - $temp.= "\n"; + $temp.= "\n"; } return ($temp); @@ -558,7 +725,9 @@ class ogroup extends plugin { $type= "I"; - foreach(array( "U" => "gosaAccount", + foreach(array( + "Y" => "gosaUserTemplate", + "U" => "gosaAccount", "G" => "posixGroup", "A" => "gosaApplication", "D" => "gosaDepartment", @@ -607,19 +776,31 @@ class ogroup extends plugin /* Permissions for that base? */ if ($this->base != ""){ - $new_dn= 'cn='.$this->cn.','.get_ou('ogroupou').$this->base; + $new_dn= 'cn='.$this->cn.','.get_ou('ogroupRDN').$this->base; } else { $new_dn= $this->dn; } + /* Check if we have workstations assigned, that are already assigned to + another object group. */ + if ($this->gosaGroupObjects == "[W]" || $this->gosaGroupObjects == "[T]" ) { + $test =array_intersect($this->used_workstations,$this->member); + if(count($test)){ + $str = ""; + foreach($test as $dn){ + $str .= "
  • ".$dn."
  • "; + } + $message[] = sprintf(_("These systems are already configured by other object groups and cannot be added:")."
    ",$str); + } + } $ldap = $this->config->get_ldap_link(); - if($this->dn != $new_dn){ + if(LDAP::fix($this->dn) != LDAP::fix($new_dn)){ $ldap->cat ($new_dn, array('dn')); } if($ldap->count() !=0){ - $message[]= _("There is already an object with this cn."); + $message[]= msgPool::duplicated(_("Name")); } /* Set new acl base */ @@ -629,12 +810,20 @@ class ogroup extends plugin /* must: cn */ if ($this->cn == ""){ - $message[]= "The required field 'Name' is not set."; + $message[]= msgPool::required(_("Name")); } /* To many different object types? */ if (strlen($this->gosaGroupObjects) > 4){ - $message[]= _("You can combine two different object types at maximum only!"); + $message[]= _("You can combine two different object types at maximum, only!"); + } + + /* 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); @@ -649,14 +838,14 @@ class ogroup extends plugin /* Move members to target array */ $this->attrs['member'] =array(); foreach ($this->member as $key => $desc){ - $this->attrs['member'][]= @LDAP::fix($key); + $this->attrs['member'][]= LDAP::fix($key); } $ldap= $this->config->get_ldap_link(); /* New accounts need proper 'dn', propagate it to remaining objects */ if ($this->dn == 'new'){ - $this->dn= 'cn='.$this->cn.','.get_ou('ogroupou').$this->base; + $this->dn= 'cn='.$this->cn.','.get_ou('ogroupRDN').$this->base; } /* Save data. Using 'modify' implies that the entry is already present, use 'add' for @@ -675,6 +864,37 @@ class ogroup extends plugin $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn)); } + /****** + Trust accounts + ******/ + $objectclasses= array(); + foreach ($this->attrs['objectClass'] as $key => $class){ + if (preg_match('/trustAccount/i', $class)){ + continue; + } + $objectclasses[]= $this->attrs['objectClass'][$key]; + } + $this->attrs['objectClass']= $objectclasses; + if ($this->trustModel != ""){ + $this->attrs['objectClass'][]= "trustAccount"; + $this->attrs['trustModel']= $this->trustModel; + $this->attrs['accessTo']= array(); + if ($this->trustModel == "byhost"){ + foreach ($this->accessTo as $host){ + $this->attrs['accessTo'][]= $host; + } + } + } else { + if ($this->was_trust_account){ + $this->attrs['accessTo']= array(); + $this->attrs['trustModel']= array(); + } + } + + /****** + Ende - Trust accounts + ******/ + /* Write back to ldap */ $ldap->cd($this->dn); $this->cleanup(); @@ -690,7 +910,8 @@ class ogroup extends plugin $this->handle_post_events($mode); $ret= 0; - if (show_ldap_error($ldap->get_error(), sprintf(_("Saving of object group/generic with dn '%s' failed."),$this->dn))){ + if (!$ldap->success()){ + msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, 0, get_class())); $ret= 1; } @@ -703,7 +924,9 @@ class ogroup extends plugin $ldap= $this->config->get_ldap_link(); $ldap->rmdir($this->dn); - show_ldap_error($ldap->get_error(), sprintf(_("Removing of object group/generic with dn '%s' failed."),$this->dn)); + if (!$ldap->success()){ + msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, 0, get_class())); + } new log("remove","ogroups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); @@ -714,10 +937,7 @@ class ogroup extends plugin function PrepareForCopyPaste($source) { - /* Update available object types */ - if(isset($source['gosaGroupObjects'][0])){ - $this->gosaGroupObjects = $source['gosaGroupObjects'][0]; - } + plugin::PrepareForCopyPaste($source); /* Reload tabs */ $this->parent->reload($this->gosaGroupObjects ); @@ -729,16 +949,10 @@ class ogroup extends plugin } } - /* Load member objects */ - if (isset($source['member'])){ - foreach ($source['member'] as $key => $value){ - if ("$key" != "count"){ - $value= @LDAP::convert($value); - $this->member["$value"]= "$value"; - } - } + $source_o = new ogroup ($this->config, $source['dn']); + foreach(array("accessTo","member","gosaGroupObjects") as $attr){ + $this->$attr = $source_o->$attr; } - } @@ -761,6 +975,17 @@ class ogroup extends plugin } + function IsReleaseManagementActivated() + { + /* Check if we should enable the release selection */ + $tmp = $this->config->search("faiManagement", "CLASS",array('menu','tabs')); + if(!empty($tmp)){ + return(true); + } + return(false); + } + + static function plInfo() { return (array( @@ -776,6 +1001,7 @@ class ogroup extends plugin "cn" => _("Name"), "base" => _("Base"), "description" => _("Description"), + "trustModel" => _("Sytem trust"), "member" => _("Member")) )); }