Code

updated acls
[gosa.git] / gosa-plugins / goto / personal / environment / class_environment.inc
index 5dbd0adf5d56e1712a72c9f8d329c1d5501a415d..0060589ccb171c36352511dd3903f6b9149d12cb 100644 (file)
@@ -68,9 +68,9 @@ class environment extends plugin
 
   var $attributes         = array("uid","gotoProfileServer","gotoProfileFlags","gotoHotplugDeviceDN",
       "gotoXResolution","gotoProfileQuota",
-      "gotoLogonScripts","gotoLogonScript",
+      "gotoLogonScript",
       "gotoPrinter", "gosaDefaultPrinter",
-      "gotoShares","gotoShare",
+      "gotoShare",
       "gotoKioskProfile");
   var $objectclasses      = array("gotoEnvironment"); // Specifies the objectClass which contains the attributes edited here 
   var $cn;
@@ -342,11 +342,8 @@ class environment extends plugin
       }
     }
 
-    /* Are we editing from MyAccount and not editing a user */
-    $WriteOnly = (!isset($this->parent)|| !$this->parent) && !session::is_set('edit');
-
     /* Check profile server */
-    if($this->acl_is_writeable("gotoProfileServer",$WriteOnly)){
+    if($this->acl_is_writeable("gotoProfileServer")){
 
       if(!empty($this->gotoProfileServer) && !isset($this->gotoProfileServers[$this->gotoProfileServer])){
 
@@ -387,9 +384,11 @@ class environment extends plugin
       }else{
         $smarty->assign($s_attr."CHK"," checked ");
       }
+    }
 
-      /* Prepare ACL settings*/
-      $smarty->assign($s_attr."ACL",$this->getacl($s_attr,$WriteOnly));
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $val => $desc){
+      $smarty->assign("$val"."ACL", $this->getacl($val));
     }
 
     /* Is accout enabled | are we editing from usermenu or admin menu 
@@ -507,16 +506,18 @@ class environment extends plugin
       }else{
         $smarty->assign($s_attr."CHK"," checked ");
       }
+    }
 
-      /* Prepare ACL settings*/
-      $smarty->assign($s_attr."ACL",$this->getacl($s_attr,$WriteOnly));
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $val => $desc){
+      $smarty->assign("$val"."ACL", $this->getacl($val));
     }
 
-    foreach(array("gotoHotplugDevice","gotoProfileFlagC","gotoProfileFlagL") as $s_attr){
-      $smarty->assign($s_attr."ACL",$this->getacl($s_attr,$WriteOnly));
+    foreach(array("gotoProfileFlagC","gotoProfileFlagL") as $s_attr){
+      $smarty->assign($s_attr."ACL",$this->getacl($s_attr));
     }
 
-    if($WriteOnly) {
+    if($this->read_only) {
       $smarty->assign("gotoPrinterACL","r");
     }else{
       $smarty->assign("gotoPrinterACL","rw");
@@ -526,15 +527,15 @@ class environment extends plugin
     $smarty->assign("useProfile",$this->useProfile);
     if(empty($this->useProfile) && !$this->multiple_support_active){
       $smarty->assign("useProfileCHK","");
-      $smarty->assign("gotoProfileServerACL" , preg_replace("/w/","",$this->getacl("gotoProfileServer",$WriteOnly)));
-      $smarty->assign("gotoProfileQuotaACL" , preg_replace("/w/","",$this->getacl("gotoProfileQuota",$WriteOnly)));
-      $smarty->assign("gotoProfileFlagCACL" , preg_replace("/w/","",$this->getacl("gotoProfileFlagC",$WriteOnly)));
+      $smarty->assign("gotoProfileServerACL" , preg_replace("/w/","",$this->getacl("gotoProfileServer")));
+      $smarty->assign("gotoProfileQuotaACL" , preg_replace("/w/","",$this->getacl("gotoProfileQuota")));
+      $smarty->assign("gotoProfileFlagCACL" , preg_replace("/w/","",$this->getacl("gotoProfileFlagC")));
     }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));
+    $smarty->assign("gotoProfileServerWriteable", $this->acl_is_writeable("gotoProfileServer"));
+    $smarty->assign("gotoProfileACL", $this->getacl("gotoProfileServer").$this->getacl("gotoProfileQuota"));
 
     /* HANDLE Profile Settings here 
      * Assign available Quota and resolution settings
@@ -856,6 +857,9 @@ class environment extends plugin
     }
 
     if($this->dialog instanceOf hotplugSelect){
+    
+      // Build up blocklist
+      session::set('filterBlacklist', array('cn' => array_keys($this->gotoHotplugDevices)));
       return($this->dialog->execute());
     }
 
@@ -1071,10 +1075,9 @@ class environment extends plugin
     /* Get all Posted vars 
      * Setup checkboxes 
      */
-    $WriteOnly = (!isset($this->parent)|| !$this->parent) && !session::is_set('edit');
     if(isset($_POST['iamposted'])){
 
-      $PACL =  $this->getacl("gotoProfileServer",$WriteOnly).$this->getacl("gotoProfileQuota",$WriteOnly);
+      $PACL =  $this->getacl("gotoProfileServer").$this->getacl("gotoProfileQuota");
 
       if(isset($_POST['kiosk_server'])){
         $tmp = $_POST['kiosk_server'];
@@ -1116,7 +1119,7 @@ class environment extends plugin
       plugin::save_object();
       foreach($this->attributes as $s_attr){
         if((!isset($_POST[$s_attr])) || 
-            in_array($s_attr,array("gosaDefaultPrinter","gotoShares","gotoHotplugDevices","gotoPrinter","gotoLogonScripts","uid"))) continue;
+            in_array($s_attr,array("gosaDefaultPrinter","gotoShare","gotoHotplugDevices","gotoPrinter","gotoLogonScripts","uid"))) continue;
         if(!$this->acl_is_writeable($s_attr)){
           continue;
         }else{ 
@@ -1778,11 +1781,13 @@ class environment extends plugin
 
           "plProvidedAcls"  => array(
 
+            "gotoPrinter"         => _("Printer") ,
             "gotoProfileServer"   => _("Profile server") ,
+            "gosaDefaultPrinter"  => _("Default printer"),
             "gotoProfileQuota"    => _("Profile quota") ,
             "gotoProfileFlagC"    => _("Cache profile localy") ,
-            "gotoShare"           => _("Shares"),
-            "gotoHotplugDevice"   => _("Hotplug devices"),
+            "gotoShare"          => _("Shares"),
+            "gotoHotplugDeviceDN" => _("Hotplug devices"),
             "gotoKioskProfile"    => _("Kiosk profile") ,
             "gotoProfileFlagL"    => _("Resolution changeable during session") ,
             "gotoXResolution"     => _("Resolution") ,