-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
guest access of public gallery causes yii\base\ErrorException #2849
Comments
Update... I tested against php 5.6 and 7.0 with the same behavior. Also, please review the attached patch file which appears to fix the problem. |
Thanks for the diff, I've applied the Gallery module part: But the check in the ActiveQueryContent seems correct. The space must be visible for guests AND also the content must public. |
Your point regarding the query is well taken. I now realize the gallery is a space but the media/images themselves aren't; they are just content. So, in retrospect the query should probably be more like:
After all, there's no point in showing a public gallery without the images. Maybe a separate issue should be created? Thoughts? |
Ok got it, now also public user profile content should be returned. |
Thanks! Worked great :-) |
What steps will reproduce the problem?
Site has "Allow limited access for non-authenticated users (guests)" checked and the user's gallery is set to public. Live example at: https://www.harleymotor.club/u/buddy/
What is the expected result?
The pictures are accessible via the stream. However, opening the gallery itself causes an exception.... either it should be allowed or a "need to authenticate" message should be presented; but an internal server error message is shown instead.
What do you get instead?
When guest attempts to visit the gallery an exception is created (note again, viewing pictures directly via stream works).
yii\base\ErrorException:8 yii\base\ErrorException: Trying to get property of non-object in /home/i98899/web/i98899.fwiw.co/public_html/protected/modules/gallery/Module.php:148 Stack trace: #0 /home/i98899/web/i98899.fwiw.co/public_html/protected/modules/gallery/Module.php(148): yii\base\ErrorHandler->handleError(8, 'Trying to get p...', '/home/i98899/we...', 148, Array) #1 /home/i98899/web/i98899.fwiw.co/public_html/protected/modules/gallery/controllers/BaseController.php(42): humhub\modules\gallery\Module::canWrite(Object(humhub\modules\user\models\User)) #2 /home/i98899/web/i98899.fwiw.co/public_html/protected/modules/gallery/views/custom-gallery/gallery_view.php(32): humhub\modules\gallery\controllers\BaseController->canWrite(false) #3 /home/i98899/web/i98899.fwiw.co/public_html/protected/vendor/yiisoft/yii2/base/View.php(330): require('/home/i98899/we...') #4 /home/i98899/web/i98899.fwiw.co/public_html/protected/vendor/yiisoft/yii2/base/View.php(250): yii\base\View->renderPhpFile('/home/i98899/we...', Array) #5 /home/i98899/web/i98899.fwiw.co/public_html/protected/vendor/yiisoft/yii2/base/View.php(152): yii\base\View->renderFile('/home/i98899/we...', Array, Object(humhub\modules\gallery\controllers\CustomGalleryController)) #6 /home/i98899/web/i98899.fwiw.co/public_html/protected/vendor/yiisoft/yii2/base/Controller.php(381): yii\base\View->render('gallery_view', Array, Object(humhub\modules\gallery\controllers\CustomGalleryController)) #7 /home/i98899/web/i98899.fwiw.co/public_html/protected/modules/gallery/controllers/CustomGalleryController.php(144): yii\base\Controller->render('gallery_view', Array) #8 /home/i98899/web/i98899.fwiw.co/public_html/protected/modules/gallery/controllers/CustomGalleryController.php(47): humhub\modules\gallery\controllers\CustomGalleryController->renderGallery() #9 [internal function]: humhub\modules\gallery\controllers\CustomGalleryController->actionView() #10 /home/i98899/web/i98899.fwiw.co/public_html/protected/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array) #11 /home/i98899/web/i98899.fwiw.co/public_html/protected/vendor/yiisoft/yii2/base/Controller.php(156): yii\base\InlineAction->runWithParams(Array) #12 /home/i98899/web/i98899.fwiw.co/public_html/protected/vendor/yiisoft/yii2/base/Module.php(523): yii\base\Controller->runAction('view', Array) #13 /home/i98899/web/i98899.fwiw.co/public_html/protected/vendor/yiisoft/yii2/web/Application.php(102): yii\base\Module->runAction('gallery/custom-...', Array) #14 /home/i98899/web/i98899.fwiw.co/public_html/protected/vendor/yiisoft/yii2/base/Application.php(380): yii\web\Application->handleRequest(Object(humhub\components\Request)) #15 /home/i98899/web/i98899.fwiw.co/public_html/index.php(25): yii\base\Application->run() #16 {main}
Additional info
The text was updated successfully, but these errors were encountered: