Fixed: canEdit error for guest user

This commit is contained in:
buddha87 2016-05-23 21:00:28 +02:00
parent 9c6d60d28f
commit a6b0ff7df9
3 changed files with 16 additions and 9 deletions

View File

@ -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();
}

View File

@ -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
*

View File

@ -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) {