Skip to content
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

[5.x]: Error when accessing User's own profile in control panel (non-admin) #15022

Closed
alexroper opened this issue May 17, 2024 · 2 comments
Closed
Labels

Comments

@alexroper
Copy link

What happened?

Description

I created a non-admin user account as a test. When I log in as this user, I receiving an error when I try to access their own profile in the control panel.

TypeError

craft\web\twig\CpExtension::craft\web\twig\{closure}(): Argument #1 ($items) must be of type array, null given, called in /var/www/html/storage/runtime/compiled_templates/c1/c1e08b6450c3c730f591d70e4fc5205f.php on line 70 and defined in /var/www/html/vendor/craftcms/cms/src/web/twig/CpExtension.php:51

Stack trace:

#0 /var/www/html/storage/runtime/compiled_templates/c1/c1e08b6450c3c730f591d70e4fc5205f.php(70): craft\web\twig\CpExtension->craft\web\twig\{closure}(NULL)
#1 /var/www/html/vendor/twig/twig/src/Template.php(394): __TwigTemplate_7618021164e327a8aa35259bcd329c14->doDisplay(Array, Array)
#2 /var/www/html/vendor/twig/twig/src/Template.php(367): Twig\Template->displayWithErrorHandling(Array, Array)
#3 /var/www/html/storage/runtime/compiled_templates/30/30a0ea7773d0e6581dd68d7078c6c1a8.php(204): Twig\Template->display(Array)
#4 /var/www/html/vendor/twig/twig/src/Template.php(171): __TwigTemplate_5a10b4d3eb49671a1bbde9a1688f6eae->block_body(Array, Array)
#5 /var/www/html/storage/runtime/compiled_templates/c2/c2c2b9654c1d5368b87ca77b3aa6b74f.php(97): Twig\Template->displayBlock('body', Array, Array)
#6 /var/www/html/vendor/twig/twig/src/Template.php(394): __TwigTemplate_4e357acee4ce548ef50aeee6c2bc8116->doDisplay(Array, Array)
#7 /var/www/html/vendor/twig/twig/src/Template.php(367): Twig\Template->displayWithErrorHandling(Array, Array)
#8 /var/www/html/storage/runtime/compiled_templates/50/506dccbfd5d772f4c9aa54f89bb2b12d.php(56): Twig\Template->display(Array, Array)
#9 /var/www/html/vendor/twig/twig/src/Template.php(394): __TwigTemplate_22953db5fe50d754e565a0eaa8c899ae->doDisplay(Array, Array)
#10 /var/www/html/vendor/twig/twig/src/Template.php(367): Twig\Template->displayWithErrorHandling(Array, Array)
#11 /var/www/html/storage/runtime/compiled_templates/30/30a0ea7773d0e6581dd68d7078c6c1a8.php(170): Twig\Template->display(Array, Array)
#12 /var/www/html/vendor/twig/twig/src/Template.php(394): __TwigTemplate_5a10b4d3eb49671a1bbde9a1688f6eae->doDisplay(Array, Array)
#13 /var/www/html/vendor/twig/twig/src/Template.php(367): Twig\Template->displayWithErrorHandling(Array, Array)
#14 /var/www/html/vendor/twig/twig/src/Template.php(379): Twig\Template->display(Array)
#15 /var/www/html/vendor/twig/twig/src/TemplateWrapper.php(38): Twig\Template->render(Array)
#16 /var/www/html/vendor/twig/twig/src/Environment.php(280): Twig\TemplateWrapper->render(Array)
#17 /var/www/html/vendor/craftcms/cms/src/web/View.php(482): Twig\Environment->render('_layouts/cp', Array)
#18 /var/www/html/vendor/craftcms/cms/src/web/View.php(535): craft\web\View->renderTemplate('_layouts/cp', Array)
#19 /var/www/html/vendor/craftcms/cms/src/web/TemplateResponseFormatter.php(57): craft\web\View->renderPageTemplate('_layouts/cp', Array, 'cp')
#20 /var/www/html/vendor/craftcms/cms/src/web/CpScreenResponseFormatter.php(208): craft\web\TemplateResponseFormatter->format(Object(craft\web\Response))
#21 /var/www/html/vendor/craftcms/cms/src/web/CpScreenResponseFormatter.php(50): craft\web\CpScreenResponseFormatter->_formatTemplate(Object(craft\web\Response), Object(craft\web\CpScreenResponseBehavior))
#22 /var/www/html/vendor/yiisoft/yii2/web/Response.php(1100): craft\web\CpScreenResponseFormatter->format(Object(craft\web\Response))
#23 /var/www/html/vendor/craftcms/cms/src/web/Response.php(337): yii\web\Response->prepare()
#24 /var/www/html/vendor/yiisoft/yii2/web/Response.php(340): craft\web\Response->prepare()
#25 /var/www/html/vendor/yiisoft/yii2/base/Application.php(390): yii\web\Response->send()
#26 /var/www/html/web/index.php(12): yii\base\Application->run()
#27 {main}

The user is part of a user group with limited permissions. Other than access to a couple sections and asset volumes, these are the other permissions they have:

Screenshot 2024-05-17 at 2 02 37 PM

If I grant the user access to the primary site (Branded) this error goes away.

Steps to reproduce

  1. Create a user account.
  2. Give the user account permission to "Access the control panel" but nothing else.
  3. Log in as this user.
  4. Click their account name in the upper right corner of the control panel to open the dropdown, then click their username.

Expected behavior

User should be able to edit their account information.

Actual behavior

Receives and error.

Craft CMS version

Craft Pro 5.1.4

PHP version

8.2.18

Operating system and version

Linux 6.6.26-linuxkit

Database type and version

MySQL 8.0.33

Image driver and version

Imagick 3.7.0 (ImageMagick 6.9.11-60)

Installed plugins and versions

  • Anchors 3.4.0
  • Asset Rev 8.0.0
  • CKEditor 4.0.6
  • Retcon 3.0.0
  • Table of contents 3.0.0
@brandonkelly
Copy link
Member

Thanks for reporting that! Fixed for the next release.

You can update to it early by changing your craftcms/cms requirement in composer.json to "5.x-dev as 5.1.4" and running composer update.

@brandonkelly
Copy link
Member

Craft 5.1.5 is out with that fix. Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants