Code

Updated ACL handling for new objects.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 6 Nov 2008 10:23:05 +0000 (10:23 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 6 Nov 2008 10:23:05 +0000 (10:23 +0000)
-The wrong base used used to check ACLs, this caused problem if user filter settings were used.

git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-lhm@12932 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/goto/admin/applications/class_applicationGeneric.inc
gosa-plugins/goto/admin/applications/class_applicationManagement.inc
gosa-plugins/goto/admin/applications/class_divListApplication.inc

index 79e6b57fd1ed008c6d8c2ee94f93cadcfdabc5de..9d88ec16146243cf393588f15841bd6d8f62e2b8 100644 (file)
@@ -62,6 +62,7 @@ class application extends plugin
 
     $this->orig_cn = $this->cn;
     $this->orig_base = $this->base;
+    $this->gosaApplicationFlags = preg_replace("/[^GDLMO]/","",$this->gosaApplicationFlags);
   }
 
 
@@ -316,10 +317,10 @@ class application extends plugin
       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);  
+          if(!$set && strstr($this->gosaApplicationFlags,$flag)){
+            $this->gosaApplicationFlags = str_replace($flag,"",$this->gosaApplicationFlags);
           }elseif($set && !preg_match("/".$flag."/",$this->gosaApplicationFlags)){
-            $this->gosaApplicationFlags = preg_replace("/]/",$flag."]",$this->gosaApplicationFlags); 
+            $this->gosaApplicationFlags .= $flag;
           }
         }  
       }
@@ -474,6 +475,7 @@ class application extends plugin
     /* Get application script without header part, to check if we must save the script itself */
     $script = preg_replace('/.*### END HEADER ###/s', '', $this->gotoLogonScript);
 
+    $this->gosaApplicationFlags ="[{$this->gosaApplicationFlags}]";
     plugin::save();
     $this->attrs["gosaApplicationIcon"]= $this->gosaApplicationIcon;
 
index bf332fed67a4135eee35fc88da6a97963f8fc740..d4d18b060ec665bf7e40f9e9bc12c77fddc6c59a 100644 (file)
@@ -34,6 +34,7 @@ class applicationManagement extends plugin
   var $enableReleaseManagement  = false;
   var $start_pasting_copied_objects = FALSE;
 
+  var $acl_base     ="";
   var $app_base     ="";
   var $app_release  ="";
   var $acl_module   = array("application");  
@@ -56,6 +57,7 @@ class applicationManagement extends plugin
     /* Save configuration for internal use */
     $this->config   = &$config;
     $this->ui       = &$ui;
+    $this->acl_base = $this->config->current['BASE'];
 
     /* Check if copy & paste is activated */
     if($this->config->boolValueIsTrue("MAIN","COPYPASTE")){
@@ -231,7 +233,13 @@ class applicationManagement extends plugin
       /* Create new usertab object */
       $this->apptabs= new apptabs($this->config,$this->config->data['TABS']['APPSTABS'], $this->dn,"application");
       $this->apptabs->parent = &$this;
-      $this->apptabs->set_acl_base($this->app_base);
+
+      /* Check if there is a snapshot dialog open */
+      if($this->IsReleaseManagementActivated()){
+        $this->apptabs->set_acl_base($this->acl_base);
+      }else{
+        $this->apptabs->set_acl_base($this->DivListApplication->selectedBase);
+      }
     }
 
 
index 2d7a31ab4693d6ed21f99ec39d4617e8633765c6..18a79c93ee38379baf6e1f8f0e68c06fe164d14a 100644 (file)
@@ -94,16 +94,22 @@ class divListApplication extends MultiSelectWindow
 
     /* Get acls */
     $ui       = get_userinfo();
-    $acl      = $ui->get_permissions($this->selectedBase,"application/application");
-    $acl_all  = $ui->has_complete_category_acls($this->parent->app_base,"application");
+
+    if($this->parent->IsReleaseManagementActivated()){
+      $acl      = $ui->get_permissions($this->parent->acl_base,"application/application");
+      $acl_all  = $ui->has_complete_category_acls($this->parent->acl_base,"application");
+    }else{
+      $acl      = $ui->get_permissions($this->selectedBase,"application/application");
+      $acl_all  = $ui->has_complete_category_acls($this->parent->app_base,"application");
+    }
 
     /* Create Layers menu */
     $s  = ".|"._("Actions")."|\n";
 
     /* Append create options */
+    $s .= "..|<img src='images/lists/new.png' alt='' border='0' class='center'>".
+      "&nbsp;"._("Create")."|\n";
     if(preg_match("/c/",$acl)) {
-      $s .= "..|<img src='images/lists/new.png' alt='' border='0' class='center'>".
-        "&nbsp;"._("Create")."|\n";
       $s.= "...|<input class='center' type='image' src='images/list_new_app' alt=''>".
         "&nbsp;"._("Application")."|appl_new|\n";
     }