From fdf85940dd30df3f5886dc3e527fa0b674170e11 Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 19 Jul 2006 07:25:56 +0000 Subject: [PATCH] Fixed user picture acls git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4225 594d385d-05f5-0310-b6e9-bd551577e9d8 --- plugins/personal/generic/class_user.inc | 53 ++++++++++++++----------- plugins/personal/generic/generic.tpl | 8 ++-- 2 files changed, 34 insertions(+), 27 deletions(-) diff --git a/plugins/personal/generic/class_user.inc b/plugins/personal/generic/class_user.inc index cbb162db7..f83bd4ca7 100644 --- a/plugins/personal/generic/class_user.inc +++ b/plugins/personal/generic/class_user.inc @@ -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); + } } diff --git a/plugins/personal/generic/generic.tpl b/plugins/personal/generic/generic.tpl index 28bd19a68..66be4d0fb 100644 --- a/plugins/personal/generic/generic.tpl +++ b/plugins/personal/generic/generic.tpl @@ -16,9 +16,11 @@ -- 2.30.2
- {render acl=$userPictureACL} - {t}Personal picture{/t} - {/render} + {if !$userPicture_is_readable} + {t}Personal picture{/t} + {else} + {t}Personal picture{/t} + {/if}