Code

Fixed user picture acls
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 19 Jul 2006 07:25:56 +0000 (07:25 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 19 Jul 2006 07:25:56 +0000 (07:25 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4225 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/personal/generic/class_user.inc
plugins/personal/generic/generic.tpl

index cbb162db7868283a45a26a9b9cba81eb2843b50b..f83bd4ca741c3cb73dfe81ac0aa2a78f844a753b 100644 (file)
@@ -301,22 +301,24 @@ class user extends plugin
     }
 
     /* Want picture edit dialog? */
-    if (isset($_POST['edit_picture'])){
-      /* Save values for later recovery, in case some presses
-         the cancel button. */
-      $this->old_jpegPhoto= $this->jpegPhoto;
-      $this->old_photoData= $this->photoData;
-      $this->picture_dialog= TRUE;
-      $this->dialog= TRUE;
-    }
+    if($this->acl_is_writeable("jpegPhoto")) {
+      if (isset($_POST['edit_picture'])){
+        /* Save values for later recovery, in case some presses
+           the cancel button. */
+        $this->old_jpegPhoto= $this->jpegPhoto;
+        $this->old_photoData= $this->photoData;
+        $this->picture_dialog= TRUE;
+        $this->dialog= TRUE;
+      }
 
-    /* Remove picture? */
-    if (isset($_POST['picture_remove'])){
-      $this->jpegPhoto= "*removed*";
-      $this->set_picture ("./images/default.jpg");
-      $this->is_modified= TRUE;
+      /* Remove picture? */
+      if (isset($_POST['picture_remove'])){
+        $this->jpegPhoto= "*removed*";
+        $this->set_picture ("./images/default.jpg");
+        $this->is_modified= TRUE;
 
-      return($smarty->fetch (get_template_path('generic_picture.tpl', TRUE, dirname(__FILE__))));
+        return($smarty->fetch (get_template_path('generic_picture.tpl', TRUE, dirname(__FILE__))));
+      }
     }
 
     /* Save picture */
@@ -496,6 +498,7 @@ class user extends plugin
     $smarty->assign("base_select",      $this->base);
     $smarty->assign("CertificatesACL",  $this->getacl("Certificate"));
     $smarty->assign("userPictureACL",   $this->getacl("userPicture"));
+    $smarty->assign("userPicture_is_readable",   $this->acl_is_readable("userPicture"));
 
     /* Create base acls */
     $baseACL = $this->getacl("base");
@@ -1129,18 +1132,20 @@ class user extends plugin
   /* Load picture from file to object */
   function set_picture($filename)
   {
-    if (!is_file($filename)){
-      $filename= "./images/default.jpg";
-      $this->jpegPhoto= "*removed*";
-    }
+    if($this->acl_is_writeable("jpegPhoto")) {
+      if (!is_file($filename)){
+        $filename= "./images/default.jpg";
+        $this->jpegPhoto= "*removed*";
+      }
 
-    $fd = fopen ($filename, "rb");
-    $this->photoData= fread ($fd, filesize ($filename));
-    $_SESSION['binary']= $this->photoData;
-    $_SESSION['binarytype']= "image/jpeg";
-    $this->jpegPhoto= "";
+      $fd = fopen ($filename, "rb");
+      $this->photoData= fread ($fd, filesize ($filename));
+      $_SESSION['binary']= $this->photoData;
+      $_SESSION['binarytype']= "image/jpeg";
+      $this->jpegPhoto= "";
 
-    fclose ($fd);
+      fclose ($fd);
+    }
   }
 
 
index 28bd19a6891da6c5e3cef3a3215f46eb7de8da0d..66be4d0fb24db31642ae31cd5545a0e41f36d208 100644 (file)
          <table>
           <tr>
                <td width="147" height="200" bgcolor="gray">
-               {render acl=$userPictureACL}
-                       <img align="center" valign="center" border="0" width="100%" src="getbin.php?rand={$rand}" alt="{t}Personal picture{/t}">
-               {/render}
+               {if !$userPicture_is_readable}
+                       <img align="center" valign="center" border="0" width="100%" src="images/default.png" alt="{t}Personal picture{/t}">
+               {else}
+                       <img align="center" valign="center" border="0" width="100%" src="getbin.php?rand={$rand}" alt="{t}Personal picture{/t}">
+               {/if}
                </td>
           </tr>
           <tr>