From 472873d5dd1310795a3bf95c6ff217f49a59d350 Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 3 Aug 2006 04:02:48 +0000 Subject: [PATCH] Added acls to nagios account git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4368 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../personal/nagios/class_nagiosAccount.inc | 28 ++- plugins/personal/nagios/main.inc | 21 +- plugins/personal/nagios/nagios.tpl | 218 +++++++++++++----- 3 files changed, 180 insertions(+), 87 deletions(-) diff --git a/plugins/personal/nagios/class_nagiosAccount.inc b/plugins/personal/nagios/class_nagiosAccount.inc index 3809cb58a..51a522cb2 100644 --- a/plugins/personal/nagios/class_nagiosAccount.inc +++ b/plugins/personal/nagios/class_nagiosAccount.inc @@ -82,9 +82,13 @@ class nagiosAccount extends plugin $display= ""; /* Do we need to flip is_account state? */ - if (isset($_POST['modify_state'])){ - $this->is_account= !$this->is_account; - } + if(isset($_POST['modify_state'])){ + if($this->is_account && $this->acl_is_removeable()){ + $this->is_account= FALSE; + }elseif(!$this->is_account && $this->acl_is_createable()){ + $this->is_account= TRUE; + } + } /* Do we represent a valid account? */ if (!$this->is_account && $this->parent == NULL){ @@ -106,10 +110,16 @@ class nagiosAccount extends plugin } } + /* Assign acls */ + $tmp = $this->plInfo(); + $SkipWrite = (!isset($this->parent) || !$this->parent) && !isset($_SESSION['edit']); + foreach($tmp['plProvidedAcls'] as $acl => $desc){ + $smarty->assign($acl."ACL",$this->getacl($acl,$SkipWrite)); + } + /* Assign attributes an ACL to smarty */ foreach($this->attributes as $val) { $smarty->assign("$val", $this->$val); - $smarty->assign("$val"."ACL", chkacl($this->acl, "$val")); if(in_array($val,$this->is_chk_box)){ if($this->$val == "checked"){ $smarty->assign($val."CHK", " checked "); @@ -191,10 +201,12 @@ class nagiosAccount extends plugin /* Specialhandling for checkboxes */ foreach($this->is_chk_box as $val){ - if(isset($_POST[$val])){ - $this->$val = "checked"; - }else{ - $this->$val = "unchecked"; + if($this->acl_is_writeable($val)){ + if(isset($_POST[$val])){ + $this->$val = "checked"; + }else{ + $this->$val = "unchecked"; + } } } } diff --git a/plugins/personal/nagios/main.inc b/plugins/personal/nagios/main.inc index e707ebfd3..a3373c242 100644 --- a/plugins/personal/nagios/main.inc +++ b/plugins/personal/nagios/main.inc @@ -54,16 +54,6 @@ if (!$remove_lock){ $_SESSION['edit']= TRUE; } - /* Adjust acl's to mode */ - if (isset($_SESSION['edit'])){ - $acl= get_permissions ($ui->dn, $ui->subtreeACL); - $nagiosAccount->acl= get_module_permission($acl, "nagiosAccount", $ui->dn); - } else { - $acl= get_permissions ($ui->dn, $ui->subtreeACL); - $editacl= get_module_permission($acl, "nagiosAccount", $ui->dn); - $nagiosAccount->acl= "#none#"; - } - /* save changes to LDAP and disable edit mode */ if (isset($_POST['edit_finish'])){ @@ -74,7 +64,6 @@ if (!$remove_lock){ if (count ($message) == 0){ $nagiosAccount->save (); gosa_log ("User/nagios object'".$ui->dn."' has been saved"); - $nagiosAccount->acl= "#none#"; del_lock ($ui->dn); sess_del ('edit'); @@ -109,11 +98,11 @@ if (!$remove_lock){ } else { $info= "\"\" ".$ui->dn." "; - if (isset($editacl) && $editacl != "#none#"){ - $info.= "\"\" "._("Click the 'Edit' button below to change informations in this dialog"); - $display.= "\n"; - } + + echo "FIXME : user -> nagios, 102 Only display edit button if there is at least one attribute editable."; + $info.= "\"\" "._("Click the 'Edit' button below to change informations in this dialog"); + $display.= "\n"; $display.= "\n"; } diff --git a/plugins/personal/nagios/nagios.tpl b/plugins/personal/nagios/nagios.tpl index cb6262148..555a228b9 100644 --- a/plugins/personal/nagios/nagios.tpl +++ b/plugins/personal/nagios/nagios.tpl @@ -1,93 +1,185 @@ + + + + +
-

 {t}Nagios Account{/t}

+

+  {t}Nagios Account{/t}

- + - + - - - - + + + + - - - - - - - - + + + + + + + + - - - - - - + + - - + + + - - + + -
{$must} +{render acl=$NagiosAliasACL} + +{/render} +
{$must} +{render acl=$NagiosMailACL} + +{/render} +
{$must} -
+ {$must} + +{render acl=$HostNotificationPeriodACL} + +{/render} +
{$must} -
{$must} -
+ {$must} + +{render acl=$ServiceNotificationPeriodACL} + +{/render} +
+ {$must} + +{render acl=$ServiceNotificationOptionsACL} + +{/render} +
{$must} -
+ {$must} + +{render acl=$HostNotificationOptionsACL} + +{/render} +
+ + +{render acl=$NagiosPagerACL} + +{/render} +
+ + +{render acl=$ServiceNotificationCommandsACL} + +{/render} +
-
+ + +{render acl=$HostNotificationCommandsACL} + +{/render} +
+   - -

 {t}Nagios authentification{/t}

+ +

+  {t}Nagios authentification{/t} +

- - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + +
{t}view system informations{/t}
{t}view configuration information{/t}
{t}trigger system commands{/t}
{t}view all services{/t}
{t}view all hosts{/t}
{t}trigger all service commands{/t}
{t}trigger all host commands{/t}
+{render acl=$AuthorizedSystemInformationACL} + {t}view system informations{/t} +{/render} +
+{render acl=$AuthorizedConfigurationInformationACL} + {t}view configuration information{/t} +{/render} +
+{render acl=$AuthorizedSystemCommandsACL} + {t}trigger system commands{/t} +{/render} +
+{render acl=$AuthorizedAllServicesACL} + {t}view all services{/t} +{/render} +
+{render acl=$AuthorizedAllHostsACL} + {t}view all hosts{/t} +{/render} +
+{render acl=$AuthorizedAllServiceCommandsACL} + {t}trigger all service commands{/t} +{/render} +
+{render acl=$AuthorizedAllHostCommandsACL} + {t}trigger all host commands{/t} +{/render} +
- - + + -- 2.30.2