index 9715ac161c635f8d0b15d3358d7e0443d387230e..ed44e8ea46b873609ce008b4eac4352f98b23ce1 100644 (file)
"W" => "workstations",
"T" => "terminals",
"F" => "phones",
"W" => "workstations",
"T" => "terminals",
"F" => "phones",
+ "_" => "subtrees",
"P" => "printers") as $key => $val){
if (preg_match("/$key/", $this->gosaGroupObjects)){
"P" => "printers") as $key => $val){
if (preg_match("/$key/", $this->gosaGroupObjects)){
}
}
register_global("ogfilter", $ogfilter);
}
}
register_global("ogfilter", $ogfilter);
-
- if(isset($_SESSION['CurrentMainBase'])){
- $this->base = $_SESSION['CurrentMainBase'];
+
+ /* Set base */
+ if ($this->dn == "new"){
+ $this->base= $_SESSION['CurrentMainBase'];
+ } else {
+ $this->base= preg_replace("/^[^,]+,".get_groups_ou()."/","",$this->dn);
}
}
- /* set permissions */
+ /* set permissions */
$ui= get_userinfo();
$acl= get_permissions ($ui->dn, $ui->subtreeACL);
$this->acl= get_module_permission($acl, "ogroup", $ui->dn);
$ui= get_userinfo();
$acl= get_permissions ($ui->dn, $ui->subtreeACL);
$this->acl= get_module_permission($acl, "ogroup", $ui->dn);
-
/* Load member data */
$this->reload();
}
/* Load member data */
$this->reload();
}
- function AddDelMembership($NewMember = false){
-
+ function AddDelMembership($NewMember = false)
+ {
if($NewMember){
if($NewMember){
+ $this->importMember($NewMember);
$this->memberList[$NewMember]= $this->objcache[$NewMember];
$this->member[$NewMember]= $NewMember;
unset ($this->objects[$NewMember]);
$this->memberList[$NewMember]= $this->objcache[$NewMember];
$this->member[$NewMember]= $NewMember;
unset ($this->objects[$NewMember]);
}
if (isset($_POST['dselect'])){
foreach( array("accounts", "groups", "applications", "departments",
}
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])) {
"phones") as $type){
if (isset($_POST[$type])) {
$smarty->assign("deplist", $this->config->idepartments);
$smarty->assign("alphabet", generate_alphabet());
foreach( array("dselect", "regex", "accounts", "groups", "applications",
$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]);
}
"printers", "phones") as $type){
$smarty->assign("$type", $ogfilter[$type]);
}
/* Perform search for selected objectClasses */
foreach($objectClasses as $class=> $basedn){
/* 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()){
/* fetch results and append them to the list */
while($attrs = $ldap->fetch()){
/* Walk through all single member entry */
foreach($this->member as $dn){
/* Walk through all single member entry */
foreach($this->member as $dn){
-
- /* The dn for the current member can't be resolved
- 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"));
-
- /* 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");
-
- } else {
-
- /* Append this entry to our all object list */
-
- /* Fetch object */
- $attrs= $ldap->fetch();
-
- $type= $this->getObjectType($attrs);
- $name= $this->getObjectName($attrs);
-
- if (isset($attrs["description"][0])){
- $this->objcache[$attrs["dn"]]= array("text" => "$name [".$attrs["description"][0]."]", "type" => "$type");
- } elseif (isset($attrs["uid"][0])) {
- $this->objcache[$attrs["dn"]]= array("text" => "$name [".$attrs["uid"][0]."]", "type" => "$type");
- } else {
- $this->objcache[$attrs["dn"]]= array("text" => "$name", "type" => "$type");
- }
- $this->objcache[$attrs["dn"]]['objectClass'] = $attrs['objectClass'];
- if(isset($attrs['uid'])){
- $this->objcache[$attrs["dn"]]['uid'] = $attrs['uid'];
- }
-
- /* Fill array */
- if (isset($attrs["description"][0])){
- $this->objects[$attrs["dn"]]= array("text" => "$name [".$attrs["description"][0]."]", "type" => "$type");
- } else {
- $this->objects[$attrs["dn"]]= array("text" => "$name", "type" => "$type");
- }
-
- $this->memberList[$dn]= $this->objects[$attrs["dn"]];
- }
+ $this->importMember($dn);
}
uasort ($this->memberList, 'sort_list');
reset ($this->memberList);
}
uasort ($this->memberList, 'sort_list');
reset ($this->memberList);
}
}
+ function importMember($dn)
+ {
+ $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"));
+
+ /* 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");
+ } else {
+ /* Append this entry to our all object list */
+
+ /* Fetch object */
+ $attrs= $ldap->fetch();
+
+ $type= $this->getObjectType($attrs);
+ $name= $this->getObjectName($attrs);
+
+ if (isset($attrs["description"][0])){
+ $this->objcache[$attrs["dn"]]= array("text" => "$name [".$attrs["description"][0]."]", "type" => "$type");
+ } elseif (isset($attrs["uid"][0])) {
+ $this->objcache[$attrs["dn"]]= array("text" => "$name [".$attrs["uid"][0]."]", "type" => "$type");
+ } else {
+ $this->objcache[$attrs["dn"]]= array("text" => "$name", "type" => "$type");
+ }
+ $this->objcache[$attrs["dn"]]['objectClass'] = $attrs['objectClass'];
+ if(isset($attrs['uid'])){
+ $this->objcache[$attrs["dn"]]['uid'] = $attrs['uid'];
+ }
+
+ /* Fill array */
+ if (isset($attrs["description"][0])){
+ $this->objects[$attrs["dn"]]= array("text" => "$name [".$attrs["description"][0]."]", "type" => "$type");
+ } else {
+ $this->objects[$attrs["dn"]]= array("text" => "$name", "type" => "$type");
+ }
+
+ $this->memberList[$dn]= $this->objects[$attrs["dn"]];
+ }
+ }
+
function convert_list($input)
{
$temp= "";
function convert_list($input)
{
$temp= "";
function getCopyDialog()
{
function getCopyDialog()
{
- $str = "";
- $str .= _("Group name");
- $str .= " <input type='text' name='cn' value='".$this->cn."'>";
- 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()
}
function saveCopyDialog()