Skip to content

User not authorized to create this element when inserting a content type with Craft matrix field and multisite #385

@theWiseCat

Description

@theWiseCat

What happened?

In my CraftCMS + Calendar setup, I have set up two sites in the same group, one for each local for my website (French and English). I use a Matrix field as a pagebuilder with the propagation method "Save entries on other sites of the same group".

When I create a new event, I can only add entries in the pagebuilder in the French site and I get the user not authorized error when I try to add an entry in the English site for the same event. I don't get this issue in my regular Craft entries, only in Calendar events.

All of this is happening as I am logged in as an admin user with every permissions available.

Errors and Stack Trace (if available)

[web.ERROR] [yii\web\HttpException:403] yii\web\ForbiddenHttpException: User not authorized to create this element. in /var/www/html/vendor/craftcms/cms/src/controllers/ElementsController.php:2513
Stack trace:
#0 /var/www/html/vendor/craftcms/cms/src/controllers/ElementsController.php(214): craft\controllers\ElementsController->_createElement()
#1 [internal function]: craft\controllers\ElementsController->actionCreate()
#2 /var/www/html/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array()
#3 /var/www/html/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams()
#4 /var/www/html/vendor/yiisoft/yii2/base/Module.php(552): yii\base\Controller->runAction()
#5 /var/www/html/vendor/craftcms/cms/src/web/Application.php(361): yii\base\Module->runAction()
#6 /var/www/html/vendor/craftcms/cms/src/web/Application.php(660): craft\web\Application->runAction()
#7 /var/www/html/vendor/craftcms/cms/src/web/Application.php(323): craft\web\Application->_processActionRequest()
#8 /var/www/html/vendor/yiisoft/yii2/base/Application.php(384): craft\web\Application->handleRequest()
#9 /var/www/html/web/index.php(12): yii\base\Application->run()
#10 {main} {"memory":10620040,"exception":"[object] (yii\\web\\ForbiddenHttpException(code: 0): User not authorized to create this element. at /var/www/html/vendor/craftcms/cms/src/controllers/ElementsController.php:2513)"}

How can we reproduce this?

  1. In Calendar > Events : Create a new Calendar event in French.
  2. Fill every required fields and save the entry.
  3. Create an entry in the pagebuilder Matrix field, still in the French event : notice that the creation of a new entry with the Matrix field works.
  4. Switch to the English event with the site selector in the breadcrumbs.
  5. Notice that the entry did not propagate to the pagebuilder Matrix field in English.
  6. Create an entry in the pagebuilder Matrix field in the English event : get the User not authorized error.

I also get the issue if creating the event in English first :

  1. In Calendar > Events : Create a new Calendar event in English.
  2. Fill every required fields and save the entry.
  3. Create an entry in the pagebuilder Matrix field, still in the English event : get the User not authorized error.

Calendar Edition

Pro

Calendar Version

5.0.16

Craft Version

5.6.17

When did this issue start?

  • Unsure
  • Fresh install of Calendar
  • After upgrading from older Calendar version
  • After upgrading from older Craft version
  • After a change to hosting configuration

Previous Calendar Version

No response

Metadata

Metadata

Assignees

Labels

6.0Calendar 6.0 releaseconfirmedBug has been confirmedfixingCurrently working in a fix for the issuelimitationA current limitation of the plugin

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions