X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=plugins%2Fadmin%2Fgroups%2Fclass_groupGeneric.inc;h=8b2c2b6ae20e7e86ee88ca1ce3f2a2c9e17cdc7c;hb=ca98ca8c7d1adccfcf78ccc86faa5d9e2d69967e;hp=7339dc335004bc90c757a2cca09213bd25330a9f;hpb=4cc6499d645861f392252cbc9c517da9e3d6347b;p=gosa.git diff --git a/plugins/admin/groups/class_groupGeneric.inc b/plugins/admin/groups/class_groupGeneric.inc index 7339dc335..8b2c2b6ae 100644 --- a/plugins/admin/groups/class_groupGeneric.inc +++ b/plugins/admin/groups/class_groupGeneric.inc @@ -32,6 +32,7 @@ class group extends plugin var $orig_dn= ""; var $has_mailAccount= FALSE; var $group_dialog= FALSE; + var $nagios_group =FALSE; /* attribute list for save action */ var $attributes= array("cn", "description", "gidNumber"); @@ -75,6 +76,11 @@ class group extends plugin } else { $this->fon_group= TRUE; } + if (array_search ('nagiosContactGroup', $this->attrs['objectClass']) == NULL ){ + $this->nagios_group= FALSE; + } else { + $this->nagios_group= TRUE; + } } /* Set mail flag */ @@ -128,6 +134,20 @@ class group extends plugin } $gufilter= get_global('gufilter'); + /* Bases / Departments */ + + if(isset($_SESSION['groupfilter']['depselect'])){ + $this->base = $_SESSION['groupfilter']['depselect']; + }else{ + if ($this->dn == "new"){ + $ui= get_userinfo(); + $this->base= dn2base($ui->dn); + } else { + $this->base= preg_replace ("/^[^,]+,[^,]+,/", "", $this->dn); + } + } + + /* This is always an account */ $this->is_account= TRUE; $this->reload(); @@ -135,9 +155,15 @@ class group extends plugin function execute() { - /* Do we represent a valid group? */ + /* Call parent execute */ + plugin::execute(); + + $ui= get_userinfo(); + $acla= get_permissions ($ui->dn, $ui->subtreeACL); + $this->acl= get_module_permission($acla, "group", $ui->dn); + /* Do we represent a valid group? */ if (!$this->is_account && $this->parent == NULL){ - $display= " ". + $display= "\"\" ". _("This 'dn' is no group.").""; return ($display); } @@ -181,6 +207,18 @@ class group extends plugin $smarty->assign("samba3", ""); } + if(search_config($this->config->data['MENU'], "nagiosaccount", "CLASS")){ + $smarty->assign("nagios",true); + }else{ + $smarty->assign("nagios",false); + } + + if(search_config($this->config->data['MENU'], "phoneAccount", "CLASS")){ + $smarty->assign("pickupGroup",true); + }else{ + $smarty->assign("pickupGroup",false); + } + /* Manage object add dialog */ if ($this->group_dialog){ @@ -230,13 +268,6 @@ class group extends plugin /* Bases / Departments */ if (isset($_POST['base'])){ $this->base= $_POST['base']; - } else { - if ($this->dn == "new"){ - $ui= get_userinfo(); - $this->base= dn2base($ui->dn); - } else { - $this->base= preg_replace ("/^[^,]+,[^,]+,/", "", $this->dn); - } } $smarty->assign("bases", $this->config->idepartments); @@ -276,6 +307,8 @@ class group extends plugin } if ($this->force_gid != "1"){ $smarty->assign("forceMode", "disabled"); + }else{ + $smarty->assign("forceMode", ""); } $smarty->assign("force_gidACL", chkacl($this->acl, "gidNumber")); $smarty->assign("sambaDomainNameACL", chkacl($this->acl, "sambaDomainName")); @@ -286,6 +319,13 @@ class group extends plugin } $smarty->assign("fon_groupACL", chkacl($this->acl, "fon_group")); + if ($this->nagios_group){ + $smarty->assign("nagios_group", "checked"); + } else { + $smarty->assign("nagios_group", ""); + } + $smarty->assign("nagios_groupACL", chkacl($this->acl, "nagios_group")); + /* Fields */ foreach (array("cn", "description", "gidNumber") as $val){ $smarty->assign("$val", $this->$val); @@ -337,7 +377,7 @@ class group extends plugin natcasesort ($this->users); reset ($this->users); - $ldap->cd ($this->config->current['BASE']); + $ldap->cd ($gufilter['dselect']); $ldap->search ("(&(objectClass=gosaAccount)(!(objectClass=gosaUserTemplate))(!(uid=*$)))"); $this->allusers= array(); while ($attrs= $ldap->fetch()){ @@ -420,7 +460,13 @@ class group extends plugin $this->fon_group= FALSE; } } - + if (chkacl ($this->acl, "nagios_group") == ""){ + if (isset ($_POST['nagios_group'])){ + $this->nagios_group= TRUE; + } else { + $this->nagios_group= FALSE; + } + } } } @@ -455,7 +501,8 @@ class group extends plugin for ($i= 0; $iattrs["objectClass"]); $i++){ if ($this->attrs['objectClass'][$i] != 'sambaGroupMapping' && $this->attrs['objectClass'][$i] != 'sambaIdmapEntry' && - $this->attrs['objectClass'][$i] != 'goFonPickupGroup'){ + $this->attrs['objectClass'][$i] != 'goFonPickupGroup' && + $this->attrs['objectClass'][$i] != 'nagiosContactGroup'){ $tmp[]= $this->attrs['objectClass'][$i]; } } @@ -507,6 +554,11 @@ class group extends plugin $this->attrs['objectClass'][]= "goFonPickupGroup"; } + /* Add nagios functionality */ + if ($this->nagios_group){ + $this->attrs['objectClass'][]= "nagiosContactGroup"; + } + /* Take members array */ if (count ($this->memberUid)){ $this->attrs['memberUid']= array_unique($this->memberUid); @@ -568,9 +620,9 @@ class group extends plugin } $ui= get_userinfo(); - $acl= get_permissions ($new_dn, $ui->subtreeACL); - $acl= get_module_permission($acl, "group", $new_dn); - if (chkacl($acl, "create") != ""){ + $acl= get_permissions ($ui->dn, $ui->subtreeACL); + $acl= get_module_permission($acl, "group", $ui->dn); + if (chkacl($this->acl, "create") != ""){ $message[]= _("You have no permissions to create a group on this 'Base'."); }