Code

Fixed connectivity intranetAccount acls
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 8 Aug 2006 06:06:52 +0000 (06:06 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 8 Aug 2006 06:06:52 +0000 (06:06 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4421 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/personal/connectivity/class_connectivity.inc
plugins/personal/connectivity/class_intranetAccount.inc
plugins/personal/connectivity/main.inc

index 83252cc8a75011f80f57e8f2c8aae3718bbde9d7..7410451c2f95271da9c3631a307c965c883c26c2 100644 (file)
@@ -30,14 +30,12 @@ class connectivity extends plugin
     /* Preseed permissions */
     $this->dn= $dn;
     $ui= get_userinfo();
-    $acl= get_permissions ($ui->dn, $ui->subtreeACL);
 
     /* Load accounts */
     foreach ($config->data['TABS']['CONNECTIVITY'] as $plug){
       $name= $plug['CLASS'];
       $this->plugin_name[]= $name;
       $this->plugin[$name]= new $name($config, $dn);
-      $this->plugin[$name]->acl= get_module_permission($acl, "$name", $ui->dn);
     }
   }
 
@@ -78,7 +76,7 @@ class connectivity extends plugin
     /* Execude  objects */
     $is_first= true;
 
-    $ReadOnly = (!is_object($this->parent) && !isset($_SESSION['edit']));
+    $ReadOnly = (!isset($this->parent) || !$this->parent) && !isset($_SESSION['edit']);
 
     foreach ($this->plugin_name as $name){
       $this->plugin[$name]->ReadOnly = $ReadOnly;
index 248047c3ced5c66e3c69d17bc91b736b1c4d5bcf..fb7f940203a07571fbc898232c77a8d691d3627b 100644 (file)
@@ -68,10 +68,11 @@ class intranetAccount extends plugin
       $smarty->assign("tabbed", 0);    
     }
 
-    if((!$this->ReadOnly) && (($this->is_account && $this->acl_is_removeable()) || (!$this->is_account && $this->acl_is_createable())) ){
+
+    $smarty->assign('gosaIntranetACL', " disabled ");
+    if((!$this->ReadOnly) && (    ($this->is_account && $this->acl_is_removeable()) 
+                               || (!$this->is_account && $this->acl_is_createable()))){
       $smarty->assign('gosaIntranetACL', "");
-    }else{
-      $smarty->assign('gosaIntranetACL', " disabled ");
     }
 
     $display.= $smarty->fetch (get_template_path('intranet.tpl', TRUE, dirname(__FILE__)));
index 3b41137e53980a6ecf578fb5af2142c36e1512bf..386324826fdbbfcb226424ff55de79c732ab927f 100644 (file)
@@ -32,6 +32,14 @@ if (!$remove_lock){
   if (!isset($_SESSION['connectivity']) || (isset($_GET['reset']) &&
       $_GET['reset'] == 1)){
     $_SESSION['connectivity']= new connectivity ($config, $ui->dn);
+    $_SESSION['connectivity']->set_acl_base($ui->dn);
+    $_SESSION['connectivity']->set_acl_category("users");
+
+    /* Adjust acl's to mode */
+    foreach ($_SESSION['connectivity']->plugin_name as $name){
+      $_SESSION['connectivity']->plugin[$name]->set_acl_category( "users");
+      $_SESSION['connectivity']->plugin[$name]->set_acl_base($ui->dn);
+    }
   }
   $connectivity= $_SESSION['connectivity'];
 
@@ -44,12 +52,13 @@ if (!$remove_lock){
   if (isset($_POST['edit'])){
 
     /* Check locking */
-    if (($username= get_lock($ui->dn)) != ""){
+    if ((($username= get_lock($ui->dn)) != "") && (!isset($_SESSION['edit']))){
       $_SESSION['back_plugin']= $plug;
       gen_locked_message ($username, $ui->dn);
       exit ();
     }
 
+
     /* Lock the current entry */
     add_lock ($ui->dn, $ui->dn);
     $_SESSION['dn']= $ui->dn;
@@ -66,7 +75,6 @@ if (!$remove_lock){
     if (count ($message) == 0){
       $connectivity->save ();
       gosa_log ("User/connectivity object'".$ui->dn."' has been saved");
-      $connectivity->acl= "#none#";
       del_lock ($ui->dn);
       sess_del ('edit');
 
@@ -78,22 +86,6 @@ if (!$remove_lock){
     }
   }
 
-  /* Adjust acl's to mode */
-  if (isset($_SESSION['edit'])){
-    $acl= get_permissions ($ui->dn, $ui->subtreeACL);
-    $connectivity->acl= get_module_permission($acl, "connectivity", $ui->dn);
-    foreach ($connectivity->plugin_name as $name){
-      $connectivity->plugin[$name]->acl= get_module_permission($acl, "$name", $ui->dn);
-    }
-  } else {
-    $acl= get_permissions ($ui->dn, $ui->subtreeACL);
-    $editacl= get_module_permission($acl, "connectivity", $ui->dn);
-    $connectivity->acl= "#none#";
-    foreach ($connectivity->plugin_name as $name){
-      $connectivity->plugin[$name]->acl= "#none#";
-    }
-  }
-
   /* Execute formular */
   $display= $connectivity->execute ();
 
@@ -104,39 +96,27 @@ if (!$remove_lock){
 
   $info= "";
 
-  /* Are we in edit mode? */
-  $in_edit_mode= false;
-  foreach ($connectivity->plugin_name as $name){
-    $acls = get_module_permission($acl, "$name", $ui->dn);
-    if($acls != "#none#"){
-      $in_edit_mode|= true;
-    }
-  }
-  if ($in_edit_mode){
-    $display.="<div align='right'>";
-    if (isset($_SESSION['edit'])){
-      $display.= "<input type=submit name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
-      $display.= "&nbsp;";
-      $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
-      $info= "<img class=\"center\" alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png').
-             "\"> ".$ui->dn."&nbsp;";
-    } else {
-      $info= "<img class=\"center\" alt=\"\" align=\"middle\" src=\"".get_template_path('images/openlock.png').
-             "\"> ".$ui->dn."&nbsp;";
-      if ($editacl != "#none#"){
-        $info.= "<img class=\"center\" alt=\"\" align=\"middle\" src=\"".get_template_path('images/lamp.png').
-                "\">"._("Click the 'Edit' button below to change informations in this dialog");
-        $display.= "<input type=submit name=\"edit\" value=\""._("Edit")."\">\n";
-      }
-      $display.= "<input type=\"hidden\" name=\"ignore\">\n";
-    }
-    $display.="</div>";
+  $display.="<div align='right'>";
+  if (isset($_SESSION['edit'])){
+    $display.= "<input type=submit name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
+    $display.= "&nbsp;";
+    $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
+    $info= "<img class=\"center\" alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png').
+      "\"> ".$ui->dn."&nbsp;";
+  } else {
+    $info= "<img class=\"center\" alt=\"\" align=\"middle\" src=\"".get_template_path('images/openlock.png').
+      "\"> ".$ui->dn."&nbsp;";
+
+    $info.= "<img class=\"center\" alt=\"\" align=\"middle\" src=\"".get_template_path('images/lamp.png').
+      "\">"._("Click the 'Edit' button below to change informations in this dialog");
+    $display.= "<input type=submit name=\"edit\" value=\""._("Edit")."\">\n";
+    $display.= "<input type=\"hidden\" name=\"ignore\">\n";
   }
-//  $display.= "</p>\n";
+  $display.="</div>";
 
   /* Page header*/
   $display= print_header(get_template_path('images/proxy.png'),
-                         _("Connectivity"), $info).$display;
+      _("Connectivity"), $info).$display;
 
 }