Code

Fixed environemnt profile server acls
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 7 Nov 2006 11:21:27 +0000 (11:21 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 7 Nov 2006 11:21:27 +0000 (11:21 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@5032 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/personal/environment/class_environment.inc
plugins/personal/environment/environment.tpl

index 940c63a729053a4f05cf657e34aeeac780569d1d..05d04b8d69a136f92802db251374bd5951ba49ca 100644 (file)
@@ -256,6 +256,30 @@ class environment extends plugin
     /* Call parent execute */
     plugin::execute();
 
+    /* Are we editing from MyAccount and not editing a user */
+    $WriteOnly = (!isset($this->parent)|| !$this->parent) && !isset($_SESSION['edit']);
+
+    /* Check profile server */
+    if($this->acl_is_writeable("gotoProfileServer",$WriteOnly)){
+      if(!empty($this->gotoProfileServer) && !isset($this->gotoProfileServers[$this->gotoProfileServer])){
+        if(count($this->gotoProfileServers)){
+
+          /* Get First Profile */
+          $new = key($this->gotoProfileServers);
+
+          /* Another profile server found */
+          print_red(sprintf(_("Your selected profile server '%s' is no longer available. Setting profile server to '%s'."),
+                $this->gotoProfileServer,$new));
+        }else{
+
+          /* No other profile servers found */
+          print_red(sprintf(_("Your selected profile server '%s' is no longer available. Profile server configuration is resetted."),
+                $this->gotoProfileServer));
+          $this->gotoProfileServer = "";
+        }
+      }
+    }    
+
     $this->detect_grouptype();
 
     /* Fill templating stuff */
@@ -264,9 +288,6 @@ class environment extends plugin
 
     $smarty->assign("is_group",$this->is_group);
 
-    /* Are we editing from MyAccount and not editing a user */
-    $WriteOnly = (!isset($this->parent)|| !$this->parent) && !isset($_SESSION['edit']);
-
     /* Prepare all variables for smarty */
     foreach($this->attributes as $s_attr){
       /* Set value*/
@@ -415,8 +436,8 @@ class environment extends plugin
     }else{
       $smarty->assign("useProfileCHK"," checked ");
     }
-
-
+    
+    $smarty->assign("gotoProfileServerWriteable", $this->acl_is_writeable("gotoProfileServer",$WriteOnly));
     $smarty->assign("gotoProfileACL", $this->getacl("gotoProfileServer",$WriteOnly).$this->getacl("gotoProfileQuota",$WriteOnly));
 
     /* HANDLE Profile Settings here 
index 1dc24115b50d42d75e7b7e8fa758bb70c292fe2c..2763b7e4fe7479097c9fcdef1017deb6b5370c02 100644 (file)
         </td>
         <td>
 {render acl=$gotoProfileServerACL}
+
+{if $gotoProfileServerWriteable}
          <select id="gotoProfileServer" name="gotoProfileServer">
           {html_options values=$gotoProfileServerKeys output=$gotoProfileServers selected=$gotoProfileServer}
           <option disabled>&nbsp;</option>
          </select>
+{else}
+         <select id="gotoProfileServer" name="gotoProfileServer">
+          {html_options values=$gotoProfileServer output=$gotoProfileServer selected=$gotoProfileServer}
+          <option disabled>&nbsp;</option>
+         </select>
+{/if}
 {/render}
         </td>
        </tr>