X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=plugins%2Fadmin%2Fogroups%2Fclass_ogroup.inc;h=7b79378f378894218e6a5fdc23e9752f1204781d;hb=c742134f3925bc3ac583d4a0d02b169b98a33a98;hp=2df483ab58b606018064b85cbf79958f88663431;hpb=3d10a1c55cf76652abdb65fc92f117ea816e33ea;p=gosa.git diff --git a/plugins/admin/ogroups/class_ogroup.inc b/plugins/admin/ogroups/class_ogroup.inc index 2df483ab5..7b79378f3 100644 --- a/plugins/admin/ogroups/class_ogroup.inc +++ b/plugins/admin/ogroups/class_ogroup.inc @@ -46,6 +46,7 @@ class ogroup extends plugin if (isset($this->attrs['member'])){ foreach ($this->attrs['member'] as $key => $value){ if ("$key" != "count"){ + $value= @LDAP::convert($value); $this->member["$value"]= "$value"; } } @@ -71,6 +72,7 @@ class ogroup extends plugin "W" => "workstations", "T" => "terminals", "F" => "phones", + "_" => "subtrees", "P" => "printers") as $key => $val){ if (preg_match("/$key/", $this->gosaGroupObjects)){ @@ -85,7 +87,7 @@ class ogroup extends plugin if ($this->dn == "new"){ $this->base= $_SESSION['CurrentMainBase']; } else { - $this->base= preg_replace("/^[^,]+,".get_groups_ou()."/","",$str); + $this->base= preg_replace("/^[^,]+,".get_groups_ou()."/","",$this->dn); } /* set permissions */ @@ -109,7 +111,7 @@ class ogroup extends plugin $this->reload(); }else{ /* Delete objects from group */ - if (isset($_POST['delete_membership']) && isset($_POST['members'])){ + if (isset($_POST['delete_membership']) && isset($_POST['members']) && chkacl($this->acl,"gosaGroupObjects") == ""){ foreach ($_POST['members'] as $value){ $this->objects["$value"]= $this->memberList[$value]; unset ($this->memberList["$value"]); @@ -121,7 +123,7 @@ class ogroup extends plugin } /* Add objects to group */ - if (isset($_POST['add_object_finish']) && isset($_POST['objects'])){ + if (isset($_POST['add_object_finish']) && isset($_POST['objects']) && chkacl($this->acl,"gosaGroupObjects") == ""){ foreach ($_POST['objects'] as $value){ $this->memberList["$value"]= $this->objects[$value]; $this->member["$value"]= $value; @@ -149,7 +151,7 @@ class ogroup extends plugin } /* Delete objects from group */ - if (isset($_POST['delete_membership']) && isset($_POST['members'])){ + if (isset($_POST['delete_membership']) && isset($_POST['members']) && chkacl($this->acl,"gosaGroupObjects") == ""){ foreach ($_POST['members'] as $value){ if(isset($this->memberList[$value])){ $this->objects["$value"]= $this->memberList[$value]; @@ -182,7 +184,7 @@ class ogroup extends plugin /* Base select dialog */ $once = true; foreach($_POST as $name => $value){ - if(preg_match("/^chooseBase/",$name) && $once){ + if(preg_match("/^chooseBase/",$name) && $once && chkacl($this->acl,"base") == ""){ $once = false; $this->dialog = new baseSelectDialog($this->config); $this->dialog->setCurrentBase($this->base); @@ -205,7 +207,7 @@ class ogroup extends plugin } /* Add objects? */ - if (isset($_POST["edit_membership"])){ + if (isset($_POST["edit_membership"]) && chkacl($this->acl,"gosaGroupObjects") == ""){ $this->group_dialog= TRUE; $this->dialog= TRUE; } @@ -228,7 +230,7 @@ class ogroup extends plugin } if (isset($_POST['dselect'])){ foreach( array("accounts", "groups", "applications", "departments", - "servers", "workstations", "terminals", "printers", + "servers", "workstations", "terminals", "printers","subtrees", "phones") as $type){ if (isset($_POST[$type])) { @@ -258,7 +260,7 @@ class ogroup extends plugin $smarty->assign("deplist", $this->config->idepartments); $smarty->assign("alphabet", generate_alphabet()); foreach( array("dselect", "regex", "accounts", "groups", "applications", - "departments", "servers", "workstations", "terminals", + "departments", "servers", "workstations", "terminals","subtrees", "printers", "phones") as $type){ $smarty->assign("$type", $ogfilter[$type]); } @@ -270,10 +272,9 @@ class ogroup extends plugin } /* Bases / Departments */ - - if (isset($_POST['base'])){ - $this->base= $_POST['base']; - } + if (isset($_POST['base']) && chkacl($this->acl,"base") == ""){ + $this->base= $_POST['base']; + } /* Assemble combine string */ if ($this->gosaGroupObjects == "[]"){ @@ -337,7 +338,6 @@ class ogroup extends plugin if (chkacl ($this->acl, "base") == "" && isset($_POST["base"])){ $this->base= $_POST["base"]; } - } } @@ -412,8 +412,15 @@ class ogroup extends plugin /* Perform search for selected objectClasses */ foreach($objectClasses as $class=> $basedn){ - $ldap->ls("(&(objectClass=".$class.")(|(uid=$regex)(cn=$regex)(ou=$regex)))",$basedn.$ogfilter['dselect'] , - array("dn", "cn", "description", "objectClass", "sn", "givenName", "uid","ou")); + + if($ogfilter['subtrees'] == "checked"){ + $ldap->cd($ogfilter['dselect']); + $ldap->search("(&(objectClass=".$class.")(|(uid=$regex)(cn=$regex)(ou=$regex)))", + array("dn", "cn", "description", "objectClass", "sn", "givenName", "uid","ou")); + }else{ + $ldap->ls("(&(objectClass=".$class.")(|(uid=$regex)(cn=$regex)(ou=$regex)))",$basedn.$ogfilter['dselect'] , + array("dn", "cn", "description", "objectClass", "sn", "givenName", "uid","ou")); + } /* fetch results and append them to the list */ while($attrs = $ldap->fetch()){ @@ -471,7 +478,7 @@ class ogroup extends plugin $ldap= $this->config->get_ldap_link(); /* 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", "uid", "description", "objectClass")); /* It has failed, add entry with type flag I (Invalid)*/ if ($ldap->error != "Success"){ @@ -524,7 +531,7 @@ class ogroup extends plugin foreach ($input as $key => $value){ /* Generate output */ - $temp.= "\n"; + $temp.= "\n"; } return ($temp); @@ -601,7 +608,7 @@ class ogroup extends plugin $ui= get_userinfo(); $acl= get_permissions ($new_dn, $ui->subtreeACL); $acl= get_module_permission($acl, "group", $new_dn); - if (chkacl($acl, "create") != ""){ + if (chkacl($acl, "create") != "" && $this->dn=="new"){ $message[]= _("You have no permissions to create a group on this 'Base'."); } @@ -682,10 +689,15 @@ class ogroup extends plugin function getCopyDialog() { - $str = ""; - $str .= _("Group name"); - $str .= " "; - return($str); + $str = ""; + + $smarty = get_smarty(); + $smarty->assign("cn", $this->cn); + $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE,dirname(__FILE__))); + $ret = array(); + $ret['string'] = $str; + $ret['status'] = ""; + return($ret); } function saveCopyDialog()