Code

Updated Application
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 21 Jul 2008 07:10:08 +0000 (07:10 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 21 Jul 2008 07:10:08 +0000 (07:10 +0000)
- Fixed ACLs

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11720 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/goto/admin/applications/class_applicationGeneric.inc
gosa-plugins/goto/admin/applications/class_applicationParameters.inc
gosa-plugins/goto/admin/applications/generic.tpl

index 4cf072e49afa7676a550a973f2561dae61a5e76b..1b6b1f6cdda125600f2b00fda394bbd6e2fc242b 100644 (file)
@@ -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
             ));
   }
 }
index 913107044b4d64bc8317448c1924fd3b3fe3f5e9..fecd5927e27a0bf6b5fda5e086222958620f37cf 100644 (file)
@@ -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; $i<count($this->option_name); $i++){
-      if (isset($_POST["remove$i"])){
-        $k= 0;
-        $on= array();
-        $ov= array();
-        for ($j= 0; $j<count($this->option_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; $i<count($this->option_name); $i++){
+        if (isset($_POST["remove$i"])){
+          $k= 0;
+          $on= array();
+          $ov= array();
+          for ($j= 0; $j<count($this->option_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.="<input type=\"submit\" name=\"add_option\" value=\""._("Add option")."\">";
+    $table.="<input type=\"submit\" name=\"add_option\" $tag value=\""._("Add option")."\">";
 
     /* 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; $i<count($this->option_name); $i++){
         $this->option_name[$i]= $_POST["option$i"];
         $this->option_value[$i]= "";
index c4c044cdae02db2cbe6936b5844c718284b36f19..3e60c16c63c1580f247ca6596e5bd98f7c346d6a 100644 (file)
     <td>
     <LABEL for="picture_file">{t}Icon{/t}</LABEL>
     <br>
+{if $IconReadable}
     <img alt="" src="getbin.php?rand={$rand}" border=1 style="width:48px; height:48; background-color:white; vertical-align:bottom;">
+{else}
+       <img src='images/empty.png' style="width:48px; height:48; background-color:white; vertical-align:bottom;" border=1 >
+{/if}
     </td>
     <td style="vertical-align:top">
     &nbsp;<br>
 <table summary="" style="width:100%;">
   <tr>
     <td style="width:50%;border-right:1px solid #B0B0B0; vertical-align:top">
-{render acl=$gosaApplicationFlagsACL}
-      <input type=checkbox name="exec_for_groupmembers" value="1" {$exec_for_groupmembers}>
+{render acl=$execForGroupmembersACL}
+      <input type=checkbox name="execForGroupmembers" value="1" {$execForGroupmembers}>
 {/render}
        {t}Only executable for members{/t}
       <br>
-{render acl=$gosaApplicationFlagsACL}
-      <input type=checkbox name="overwrite_config" value="1" {$overwrite_config}>
+{render acl=$overwriteConfigACL}
+      <input type=checkbox name="overwriteConfig" value="1" {$overwriteConfig}>
 {/render}
        {t}Replace user configuration on startup{/t}
     </td>
     <td>
-{render acl=$gosaApplicationFlagsACL}
-      <input type=checkbox name="place_on_desktop" value="1" {$place_on_desktop}>
+{render acl=$placeOnDesktopACL}
+      <input type=checkbox name="placeOnDesktop" value="1" {$placeOnDesktop}>
 {/render}
       {t}Place icon on members desktop{/t}
       <br>
-{render acl=$gosaApplicationFlagsACL}
-      <input type=checkbox name="place_in_startmenu" value="1" {$place_in_startmenu}>
+{render acl=$placeInStartmenuACL}
+      <input type=checkbox name="placeInStartmenu" value="1" {$placeInStartmenu}>
 {/render}
       {t}Place entry in members startmenu{/t}
       <br>
-{render acl=$gosaApplicationFlagsACL}
-      <input type=checkbox name="place_on_kicker" value="1" {$place_on_kicker}>
+{render acl=$placeOnKickerACL}
+      <input type=checkbox name="placeOnKicker" value="1" {$placeOnKicker}>
 {/render}
       {t}Place entry in members launch bar{/t}
     </td>