Fix #4650: adminCanChangeUserProfileImages option has not effect

This commit is contained in:
buddh4 2020-11-26 15:28:23 +01:00
parent d5835211a3
commit 4b13c96f9c
4 changed files with 8 additions and 7 deletions

View File

@ -13,6 +13,7 @@ HumHub Changelog
- Fix #4636: Jplayer overflow on mobile stream
- Fix #4591: Registration error text "You are already logged in!" not translatable
- Fix #4630: Transfer default content of user approve/decline email to approve/decline form
- Fix #4650: `adminCanChangeUserProfileImages` option has not effect
1.7.0 (November 4, 2020)
------------------------

View File

@ -3,6 +3,7 @@
namespace humhub\modules\content\widgets;
use humhub\modules\user\controllers\ImageController;
use Yii;
use humhub\modules\content\components\ContentContainerActiveRecord;
use humhub\modules\space\models\Space;
@ -91,8 +92,8 @@ class ContainerProfileHeader extends JsWidget
$this->classPrefix = 'profile';
if(!Yii::$app->user->isGuest) {
$canEditAsAdmin = (Yii::$app->user->isAdmin() && Yii::$app->getModule('user')->adminCanChangeUserProfileImages);
$this->canEdit = Yii::$app->user->identity->is($this->container) || $canEditAsAdmin;
/** @TODO move this out of ImageController layer... */
$this->canEdit = ImageController::canEditProfileImage($this->container);
}
}

View File

@ -70,11 +70,11 @@ $profileImageUpload = Upload::withName($imageUploadName, ['url' => $imageUploadU
<div class="image-upload-container profile-user-photo-container" style="width: 140px; height: 140px;">
<?php if ($container->getProfileImage()->hasImage()) : ?>
<a data-ui-gallery="spaceHeader" href="<?= $container->profileImage->getUrl('_org'); ?>">
<?= $container->getProfileImage()->render( 140, ['class' => 'img-profile-header-background profile-user-photo', 'link' => false]); ?>
<a data-ui-gallery="spaceHeader" href="<?= $container->profileImage->getUrl('_org') ?>">
<?= $container->getProfileImage()->render( 140, ['class' => 'img-profile-header-background profile-user-photo', 'link' => false]) ?>
</a>
<?php else : ?>
<?= $container->getProfileImage()->render(140, ['class' => 'img-profile-header-background profile-user-photo']); ?>
<?= $container->getProfileImage()->render(140, ['class' => 'img-profile-header-background profile-user-photo']) ?>
<?php endif; ?>
<?php if ($canEdit) : ?>

View File

@ -80,8 +80,7 @@ class ImageController extends ContainerImageController
return true;
}
if (Yii::$app->getModule('user')->adminCanChangeUserProfileImages &&
$user->permissionManager->can(ManageUsers::class)) {
if (Yii::$app->getModule('user')->adminCanChangeUserProfileImages && Yii::$app->user->can(ManageUsers::class)) {
return true;
}