Code

Updated repository service
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 23 Jul 2008 08:04:53 +0000 (08:04 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 23 Jul 2008 08:04:53 +0000 (08:04 +0000)
-Fixed ACLs for section add/delete.

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

gosa-plugins/fai/admin/systems/services/repository/class_servRepository.inc
gosa-plugins/fai/admin/systems/services/repository/class_servRepositorySetup.inc

index 759d45d7149232a529564046194540ddad0b4cb6..349f28ef38ad32772f10583374c7161a6616979e 100644 (file)
@@ -306,8 +306,6 @@ class servrepository extends goService
   {
     $fields = goService::getListEntry();
     $fields['Message']    = _("Repository service");
-    #$fields['AllowEdit']  = true;
-    #$fields['AllowStart'] = #$fields['AllowStop'] = #$fields['AllowRestart'] = false;
     return($fields);
   }
 
@@ -351,15 +349,16 @@ class servrepository extends goService
           "plCategory"    => array("server"),
 
           "plProvidedAcls"=> array(
-              "cn"            => _("Name"),
-              "start"         => _("Start"),
-              "stop"          => _("Stop"),
-              "restart"       => _("Restart"),
-              "Release"       => _("Releases"),
-              "Section"       => _("Sections"),
-              "ParentServer"  => _("Parent server"),
-              "Url"           => _("Url"))
-            ));
+#            "start"         => _("Service start"),  // Remove this to hide the start button at all.
+#            "stop"          => _("Service stop"),   // Remove this to hide the stop button at all.
+#            "restart"       => _("Service restart"),// Remove this to hide the restart button at all.
+
+            "cn"            => _("Name"),
+            "Release"       => _("Releases"),
+            "Section"       => _("Sections"),
+            "ParentServer"  => _("Parent server"),
+            "Url"           => _("Url"))
+          ));
   }
 }
 
index ac3509a8e42292b84e4b22e90c04929580f59074..0c4bbd1c99b58cb3b810f988fffb5679a744c56b 100644 (file)
@@ -46,7 +46,7 @@ class servRepositorySetup  extends plugin
     return(false);
   }
 
-  
+
 
   function execute()
   {
@@ -56,51 +56,52 @@ class servRepositorySetup  extends plugin
     /* Fill templating stuff */
     $smarty= get_smarty();
 
-    if((isset($_POST['AddSection']))&&(isset($_POST['SectionName']))&&(!empty($_POST['SectionName']))){
+    if(preg_match("/w/",$this->parent->getacl("Section"))){
+      if((isset($_POST['AddSection']))&&(isset($_POST['SectionName']))&&(!empty($_POST['SectionName']))){
 
-      /* Replace multiple spaces with a single, and cut of white spaces (trim)*/
-      $val = preg_replace("/\ \ * /" , " ", trim($_POST['SectionName']));
+        /* Replace multiple spaces with a single, and cut of white spaces (trim)*/
+        $val = preg_replace("/\ \ * /" , " ", trim($_POST['SectionName']));
 
-      /* check if there are more than one entry given ( "section1 section2 )*/
-      if(preg_match("/ /",$val)){
+        /* check if there are more than one entry given ( "section1 section2 )*/
+        if(preg_match("/ /",$val)){
 
-        /* Generate list of new section names */
-        $vals = split(" ",$val);
+          /* Generate list of new section names */
+          $vals = split(" ",$val);
 
-        /* Add new entries */
-        foreach($vals as $entry){
-          $entry = trim($entry);
-          if(!empty($entry)){
-            $this->Sections[$entry]=$entry;
+          /* Add new entries */
+          foreach($vals as $entry){
+            $entry = trim($entry);
+            if(!empty($entry)){
+              $this->Sections[$entry]=$entry;
+            }
           }
+        }else{
+          $this->Sections[$val]=$val;
         }
-      }else{
-        $this->Sections[$val]=$val;
       }
-    }
-    
-    foreach($_POST as $name => $value){
-      if(preg_match("/^delete_/",$name)){
 
-        $val = preg_replace("/^delete_/","",$name);
-        $val = base64_decode(preg_replace("/_.*$/","",$val));
+      foreach($_POST as $name => $value){
+        if(preg_match("/^delete_/",$name)){
 
-        if(isset($this->Sections[$val])){
-          unset($this->Sections[$val]);
+          $val = preg_replace("/^delete_/","",$name);
+          $val = base64_decode(preg_replace("/_.*$/","",$val));
+
+          if(isset($this->Sections[$val])){
+            unset($this->Sections[$val]);
+          }
         }
       }
     }
 
     $divlist = new divSelectBox("servRepositorySetup");
     $divlist->setHeight("220");
-
     $dellink = "<input type='image' src='images/lists/trash.png' title='delete' alt='delete' name='delete_%s' value='%s'>";
-
     foreach($this->Sections as $sec){
       $divlist->AddEntry(array(
-                              array("string"=>$sec),
-                              array("string"=>sprintf($dellink,base64_encode($sec),$sec),"attach"=>"style='border-right:0px;width:20px;'")
-                              ));
+            array("string"=>$sec),
+            array("string"=>sprintf($dellink,base64_encode($sec),$sec),
+              "attach"=>"style='border-right:0px;width:20px;'")
+            ));
     }
   
     $smarty->assign("Sections",$divlist->DrawList());