mirror of
https://github.com/humhub/humhub.git
synced 2025-01-18 06:38:14 +01:00
Fixed: canEdit error for guest user
This commit is contained in:
parent
9c6d60d28f
commit
a6b0ff7df9
@ -554,7 +554,11 @@ class Content extends \humhub\components\ActiveRecord
|
||||
*/
|
||||
public function canEdit($user = null)
|
||||
{
|
||||
if ($user === null && !Yii::$app->user->isGuest) {
|
||||
if(Yii::$app->user->isGuest) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($user === null) {
|
||||
$user = Yii::$app->user->getIdentity();
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,6 @@ class AccountProfilMenu extends \humhub\widgets\BaseMenu
|
||||
'isActive' => (Yii::$app->controller->module && Yii::$app->controller->module->id == 'user' && Yii::$app->controller->id == 'account' && (Yii::$app->controller->action->id == 'change-email' || Yii::$app->controller->action->id == 'change-email-validate')),
|
||||
));
|
||||
|
||||
|
||||
if (Yii::$app->user->canChangePassword()) {
|
||||
$this->addItem(array(
|
||||
'label' => Yii::t('UserModule.base', 'Change Password'),
|
||||
@ -63,13 +62,6 @@ class AccountProfilMenu extends \humhub\widgets\BaseMenu
|
||||
parent::init();
|
||||
}
|
||||
|
||||
public function run()
|
||||
{
|
||||
if (count($this->items) > 1) {
|
||||
return parent::run();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns optional authclients
|
||||
*
|
||||
|
@ -72,6 +72,11 @@ class AuthChoice extends \yii\authclient\widgets\AuthChoice
|
||||
return count($authClients) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters out clients which need login form
|
||||
* @param type $clients
|
||||
* @return \humhub\modules\user\authclient\BaseFormAuth
|
||||
*/
|
||||
private static function filterClients($clients)
|
||||
{
|
||||
$result = [];
|
||||
@ -97,6 +102,9 @@ class AuthChoice extends \yii\authclient\widgets\AuthChoice
|
||||
return $baseAuthUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
if(count($this->getClients()) == 0) {
|
||||
@ -106,6 +114,9 @@ class AuthChoice extends \yii\authclient\widgets\AuthChoice
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
if(count($this->getClients()) == 0) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user