Fixed #1205: Space remove member broken

This commit is contained in:
Lucas Bartholemy 2015-09-23 12:57:19 +02:00
parent 50066e7c69
commit 72a8881f1a
2 changed files with 7 additions and 7 deletions

View File

@ -201,18 +201,18 @@ class AdminController extends \humhub\modules\content\components\ContentContaine
{
$this->forcePostRequest();
$workspace = $this->getSpace();
$space = $this->getSpace();
$userGuid = Yii::$app->request->get('userGuid');
$user = User::model()->findByAttributes(array('guid' => $userGuid));
$user = User::findOne(array('guid' => $userGuid));
if ($workspace->isSpaceOwner($user->id)) {
throw new CHttpException(500, 'Owner cannot be removed!');
if ($space->isSpaceOwner($user->id)) {
throw new HttpException(500, 'Owner cannot be removed!');
}
$workspace->removeMember($user->id);
$space->removeMember($user->id);
// Redirect back to Administration page
$this->htmlRedirect($this->createUrl('//space/admin/members', array('sguid' => $workspace->guid)));
return $this->htmlRedirect($space->createUrl('/space/admin/members'));
}
/**

View File

@ -129,7 +129,7 @@ use humhub\modules\space\models\Space;
'buttonFalse' => Yii::t('SpaceModule.views_admin_members', 'No, cancel'),
'cssClass' => 'btn btn-sm btn-danger',
'linkContent' => Yii::t('SpaceModule.views_admin_members', 'Remove'),
'linkHref' => $space->createUrl('//space/admin/removeMember', array('userGuid' => $user->guid, 'ajax' => 1))
'linkHref' => $space->createUrl('/space/admin/remove-member', array('userGuid' => $user->guid, 'ajax' => 1))
));
?>