From fa995cc8a294480b9783786f402ac4a36e65147c Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 21 Jul 2008 07:10:08 +0000 Subject: [PATCH] Updated Application - Fixed ACLs git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11720 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../applications/class_applicationGeneric.inc | 53 +++++++++--------- .../class_applicationParameters.inc | 56 +++++++++++-------- .../goto/admin/applications/generic.tpl | 24 ++++---- 3 files changed, 71 insertions(+), 62 deletions(-) diff --git a/gosa-plugins/goto/admin/applications/class_applicationGeneric.inc b/gosa-plugins/goto/admin/applications/class_applicationGeneric.inc index 4cf072e49..1b6b1f6cd 100644 --- a/gosa-plugins/goto/admin/applications/class_applicationGeneric.inc +++ b/gosa-plugins/goto/admin/applications/class_applicationGeneric.inc @@ -118,6 +118,7 @@ class application extends plugin foreach($tmp['plProvidedAcls'] as $name => $translation){ $smarty->assign($name."ACL",$this->getacl($name, preg_match("/freeze/i",$this->FAIstate))); } + $smarty->assign("IconReadable", $this->acl_is_readable("gosaApplicationIcon")); /* Do we represent a valid group? */ if (!$this->is_account && $this->parent === NULL){ @@ -205,10 +206,10 @@ class application extends plugin } /* Checkboxes */ - foreach (array("G" => "exec_for_groupmembers", "O" => "overwrite_config", - "L" => "place_on_kicker", - "D" => "place_on_desktop", "M" => "place_in_startmenu") as $key => $val){ - if (preg_match("/$key/", $this->gosaApplicationFlags)){ + foreach (array("G" => "execForGroupmembers", "O" => "overwriteConfig", + "L" => "placeOnKicker", + "D" => "placeOnDesktop", "M" => "placeInStartmenu") as $key => $val){ + if (preg_match("/$key/", $this->gosaApplicationFlags) && $this->acl_is_readable("$val")){ $smarty->assign("$val", "checked"); } else { $smarty->assign("$val", ""); @@ -305,25 +306,22 @@ class application extends plugin /* Save attributes */ parent::save_object(); + $checks = array("execForGroupmembers" => "G", + "placeOnDesktop" => "D", + "placeOnKicker" => "L", + "placeInStartmenu" => "M", + "overwriteConfig" => "O"); + /* Save application flags */ - $flag= ""; - if (isset($_POST['exec_for_groupmembers']) && $_POST['exec_for_groupmembers'] == 1){ - $flag.= "G"; - } - if (isset($_POST['place_on_desktop']) && $_POST['place_on_desktop'] == 1){ - $flag.= "D"; - } - if (isset($_POST['place_on_kicker']) && $_POST['place_on_kicker'] == 1){ - $flag.= "L"; - } - if (isset($_POST['place_in_startmenu']) && $_POST['place_in_startmenu'] == 1){ - $flag.= "M"; - } - if (isset($_POST['overwrite_config']) && $_POST['overwrite_config'] == 1){ - $flag.= "O"; - } - if ($this->acl_is_writeable("gosaApplicationFlags")){ - $this->gosaApplicationFlags= "[$flag]"; + foreach($checks as $name => $flag){ + if($this->acl_is_writeable($name)){ + $set = isset($_POST[$name]) && $_POST[$name] == 1; + if(!$set && preg_match("/".$flag."/",$this->gosaApplicationFlags)){ + $this->gosaApplicationFlags = preg_replace("/".$flag."/","",$this->gosaApplicationFlags); + }elseif($set && !preg_match("/".$flag."/",$this->gosaApplicationFlags)){ + $this->gosaApplicationFlags = preg_replace("/]/",$flag."]",$this->gosaApplicationFlags); + } + } } /* Remove current picture */ @@ -608,14 +606,13 @@ class application extends plugin "gosaApplicationExecute" => _("Execute"), "gosaApplicationName" => _("Name"), "gosaApplicationIcon" => _("Icon"), - "gosaApplicationFlags" => _("Flag"), "gotoLogonScript" => _("Script content"), - "exec_for_groupmembers" => _("Only executable for members"), // G - "place_on_desktop" => _("Place icon on members desktop"), // D - "place_on_kicker" => _("Place entry in members launch bar"), // L - "place_in_startmenu" => _("Place entry in members startmenu"), // M - "overwrite_config" => _("Replace user configuration on startup")) // O + "execForGroupmembers" => _("Only executable for members"), // G + "placeOnDesktop" => _("Place icon on members desktop"), // D + "placeOnKicker" => _("Place entry in members launch bar"), // L + "placeInStartmenu" => _("Place entry in members startmenu"), // M + "overwriteConfig" => _("Replace user configuration on startup")) // O )); } } diff --git a/gosa-plugins/goto/admin/applications/class_applicationParameters.inc b/gosa-plugins/goto/admin/applications/class_applicationParameters.inc index 913107044..fecd5927e 100644 --- a/gosa-plugins/goto/admin/applications/class_applicationParameters.inc +++ b/gosa-plugins/goto/admin/applications/class_applicationParameters.inc @@ -38,8 +38,12 @@ class applicationParameters extends plugin plugin::execute(); /* 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; + } } /* Show tab dialog headers */ @@ -54,29 +58,32 @@ class applicationParameters extends plugin } } - /* Add option to list */ - if (isset($_POST['add_option'])){ - $i= count($this->option_name); - $this->option_name[$i]= ""; - $this->option_value[$i]= ""; - } + if($this->acl_is_writeable("gosaApplicationParameter")){ - /* Remove value from list */ - for ($i= 0; $ioption_name); $i++){ - if (isset($_POST["remove$i"])){ - $k= 0; - $on= array(); - $ov= array(); - for ($j= 0; $joption_name); $j++){ - if ($j != $i){ - $on[$k]= $this->option_name[$j]; - $ov[$k]= $this->option_value[$j]; - $k++; + /* Add option to list */ + if (isset($_POST['add_option'])){ + $i= count($this->option_name); + $this->option_name[$i]= ""; + $this->option_value[$i]= ""; + } + + /* Remove value from list */ + for ($i= 0; $ioption_name); $i++){ + if (isset($_POST["remove$i"])){ + $k= 0; + $on= array(); + $ov= array(); + for ($j= 0; $joption_name); $j++){ + if ($j != $i){ + $on[$k]= $this->option_name[$j]; + $ov[$k]= $this->option_value[$j]; + $k++; + } } + $this->option_name= $on; + $this->option_value= $ov; + break; } - $this->option_name= $on; - $this->option_value= $ov; - break; } } @@ -85,6 +92,7 @@ class applicationParameters extends plugin $this->option_name[]= ""; $this->option_value[]= ""; } + $acl = $this->getacl("gosaApplicationParameter") ; @@ -120,7 +128,7 @@ class applicationParameters extends plugin } } $table.= ""; - $table.=""; + $table.=""; /* Show main page */ $smarty= get_smarty(); @@ -161,7 +169,7 @@ class applicationParameters extends plugin /* Save data to object */ function save_object() { - if (isset($_POST['option0'])){ + if (isset($_POST['option0']) && $this->acl_is_writeable("gosaApplicationParameter")){ for ($i= 0; $ioption_name); $i++){ $this->option_name[$i]= $_POST["option$i"]; $this->option_value[$i]= ""; diff --git a/gosa-plugins/goto/admin/applications/generic.tpl b/gosa-plugins/goto/admin/applications/generic.tpl index c4c044cda..3e60c16c6 100644 --- a/gosa-plugins/goto/admin/applications/generic.tpl +++ b/gosa-plugins/goto/admin/applications/generic.tpl @@ -65,7 +65,11 @@
+{if $IconReadable} +{else} + +{/if}  
@@ -93,29 +97,29 @@ -- 2.30.2
-{render acl=$gosaApplicationFlagsACL} - +{render acl=$execForGroupmembersACL} + {/render} {t}Only executable for members{/t}
-{render acl=$gosaApplicationFlagsACL} - +{render acl=$overwriteConfigACL} + {/render} {t}Replace user configuration on startup{/t}
-{render acl=$gosaApplicationFlagsACL} - +{render acl=$placeOnDesktopACL} + {/render} {t}Place icon on members desktop{/t}
-{render acl=$gosaApplicationFlagsACL} - +{render acl=$placeInStartmenuACL} + {/render} {t}Place entry in members startmenu{/t}
-{render acl=$gosaApplicationFlagsACL} - +{render acl=$placeOnKickerACL} + {/render} {t}Place entry in members launch bar{/t}