mirror of
https://github.com/humhub/humhub.git
synced 2025-01-17 14:18:27 +01:00
Better error handling when user is not logged in
This commit is contained in:
parent
6b7e5ad7e9
commit
4db81eee83
@ -74,6 +74,12 @@ class ContentContainerController extends Controller
|
|||||||
]);
|
]);
|
||||||
$this->subLayout = "@humhub/modules/space/views/space/_layout";
|
$this->subLayout = "@humhub/modules/space/views/space/_layout";
|
||||||
|
|
||||||
|
// Handle case, if a non-logged user tries to acccess a hidden space
|
||||||
|
// Redirect to Login instead of showing error
|
||||||
|
if ($this->contentContainer->visibility == Space::VISIBILITY_NONE && Yii::$app->user->isGuest) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
} elseif ($userGuid !== null) {
|
} elseif ($userGuid !== null) {
|
||||||
|
|
||||||
$this->contentContainer = User::findOne(['guid' => $userGuid]);
|
$this->contentContainer = User::findOne(['guid' => $userGuid]);
|
||||||
@ -92,12 +98,6 @@ class ContentContainerController extends Controller
|
|||||||
throw new HttpException(500, Yii::t('base', 'Could not determine content container!'));
|
throw new HttpException(500, Yii::t('base', 'Could not determine content container!'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Auto check access rights to this container
|
|
||||||
*/
|
|
||||||
if ($this->contentContainer != null && $this->autoCheckContainerAccess) {
|
|
||||||
$this->checkContainerAccess();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$this->checkModuleIsEnabled()) {
|
if (!$this->checkModuleIsEnabled()) {
|
||||||
throw new HttpException(405, Yii::t('base', 'Module is not enabled on this content container!'));
|
throw new HttpException(405, Yii::t('base', 'Module is not enabled on this content container!'));
|
||||||
@ -121,6 +121,11 @@ class ContentContainerController extends Controller
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Auto check access rights to this container
|
||||||
|
if ($this->contentContainer != null && $this->autoCheckContainerAccess) {
|
||||||
|
$this->checkContainerAccess();
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->contentContainer instanceof Space && (Yii::$app->request->isPjax || !Yii::$app->request->isAjax)) {
|
if ($this->contentContainer instanceof Space && (Yii::$app->request->isPjax || !Yii::$app->request->isAjax)) {
|
||||||
$options = [
|
$options = [
|
||||||
'guid' => $this->contentContainer->guid,
|
'guid' => $this->contentContainer->guid,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user