Code

Initial application acl checkin
[gosa.git] / plugins / admin / applications / class_applicationManagement.inc
index 5a3cecedea1eb7e1cd27033fe9a2762531217ff1..6029010c1348eda4260bbe879847596e0f3b38cb 100644 (file)
@@ -31,7 +31,6 @@ class applicationManagement extends plugin
   var $CopyPasteHandler         = NULL;
   var $DivListApplication       = NULL;
   var $applications             = array();
-  var $acl                      = "";
   var $enableReleaseManagement  = false;
 
   function IsReleaseManagementActivated()
@@ -171,9 +170,8 @@ class applicationManagement extends plugin
       $this->dn= "new";
 
       /* Create new usertab object */
-      $this->apptabs= new apptabs($this->config,
-          $this->config->data['TABS']['APPSTABS'], $this->dn);
-      $this->apptabs->set_acl(array(':all'));
+      $this->apptabs= new apptabs($this->config,$this->config->data['TABS']['APPSTABS'], $this->dn,"application");
+      $this->apptabs->set_acl_base($this->dn);
     }
 
 
@@ -250,13 +248,9 @@ class applicationManagement extends plugin
          above dialog */
       add_lock ($this->dn, $this->ui->dn);
 
-      /* Set up the users ACL's for this 'dn' */
-      $acl= get_permissions ($this->dn, $this->ui->subtreeACL);
-
       /* Register apptabs to trigger edit dialog */
-      $this->apptabs= new apptabs($this->config,
-          $this->config->data['TABS']['APPSTABS'], $this->dn);
-      $this->apptabs->set_acl($acl);
+      $this->apptabs= new apptabs($this->config,$this->config->data['TABS']['APPSTABS'], $this->dn,"application");
+      $this->apptabs->set_acl_base($this->dn);
       $_SESSION['objectinfo']= $this->dn;
     }
 
@@ -273,10 +267,10 @@ class applicationManagement extends plugin
 
       /* Load permissions for selected 'dn' and check if
          we're allowed to remove this 'dn' */
-      $acl= get_permissions ($this->dn, $this->ui->subtreeACL);
-      $this->acl= get_module_permission($acl, "application", $this->dn);
-      if (chkacl($this->acl, "delete") == ""){
+      $ui = get_userinfo();
+      $acl = $ui->get_permissions($this->dn ,"application/application");
 
+      if(preg_match("/d/",$acl)){
         /* Check locking, save current plugin in 'back_plugin', so
            the dialog knows where to return. */
         if (($user= get_lock($this->dn)) != ""){
@@ -306,12 +300,14 @@ class applicationManagement extends plugin
 
       /* Some nice guy may send this as POST, so we've to check
          for the permissions again. */
-      if (chkacl($this->acl, "delete") == ""){
+      $ui = get_userinfo();
+      $acl = $ui->get_permissions($this->dn ,"application/application");
+
+      if(preg_match("/d/",$acl)){
 
         /* Delete request is permitted, perform LDAP action */
-        $this->apptabs= new apptabs($this->config,
-            $this->config->data['TABS']['APPSTABS'], $this->dn);
-        $this->apptabs->set_acl(array($this->acl));
+        $this->apptabs= new apptabs($this->config, $this->config->data['TABS']['APPSTABS'], $this->dn,"application");
+        $this->apptabs->set_acl_base($this->dn);
         $this->apptabs->delete ();
         gosa_log ("Application object'".$this->dn."' has been removed");
         unset ($this->apptabs);
@@ -364,9 +360,9 @@ class applicationManagement extends plugin
       Dialog display
      ****************/
 
-    $useBase = $this->DivListApplication->selectedRelease;
     /* Check if there is a snapshot dialog open */
-    if($str = $this->showSnapshotDialog($this->DivListApplication->selectedBase,$useBase)){
+    $base = $this->DivListApplication->selectedBase;
+    if($str = $this->showSnapshotDialog($base,$this->get_used_snapshot_bases($base))){
       return($str);
     }
 
@@ -380,6 +376,16 @@ class applicationManagement extends plugin
   }
 
 
+  /* Return departments, that will be included within snapshot detection */
+  function get_used_snapshot_bases(){
+    if($this->DivListApplication->selectedRelease == "main"){
+      return(array($this->DivListApplication->selectedBase));
+    }else{
+      return(array($this->DivListApplication->selectedRelease));
+    }
+  }
+
+
   function reload()
   {
     $this->applications= array();
@@ -408,7 +414,7 @@ class applicationManagement extends plugin
       $Flags    |= GL_SUBSEARCH;  
     }
    
-    $res= get_list($Filter, $this->ui->subtreeACL,$use_base, array("cn","description","dn","objectClass"), $Flags);
+    $res= get_list($Filter, "application", $use_base, array("cn","description","dn","objectClass"), $Flags);
     foreach ($res as $val){
       $tmp[strtolower($val['cn'][0]).$val['cn'][0]]=$val;
     }
@@ -482,7 +488,6 @@ class applicationManagement extends plugin
   function check() {}
   function adapt_from_template($dn) {}
   function password_change_needed() {}
-  function show_header($button_text, $text, $disabled= FALSE) {}
 }
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
 ?>