craftcms / cms

Build bespoke content experiences with Craft.
https://craftcms.com
Other
3.28k stars 635 forks source link

[5.x]: Can't drag an entry to add it as a child of another #14831

Closed benfeather closed 6 months ago

benfeather commented 6 months ago

What happened?

Description

Can't drag an entry in the table view to add it as a child of another:

https://github.com/craftcms/cms/assets/43571410/ec5b8285-d627-4fb1-92b1-6e4fb00dc177

It says, "The User is not authorized to perform this action," but I'm logged in with an admin account.

{
    "name": "Forbidden",
    "message": "User is not authorized to perform this action",
    "code": 0,
    "status": 403,
    "exception": "yii\\web\\ForbiddenHttpException",
    "file": "/mnt/data/www/tepari.cms/vendor/craftcms/cms/src/web/Controller.php",
    "line": 518,
    "trace": [
        {
            "file": "/mnt/data/www/tepari.cms/vendor/craftcms/cms/src/controllers/StructuresController.php",
            "line": 61,
            "function": "requireAuthorization",
            "class": "craft\\web\\Controller",
            "type": "->"
        },
        {
            "file": "/mnt/data/www/tepari.cms/vendor/yiisoft/yii2/base/Controller.php",
            "line": 176,
            "function": "beforeAction",
            "class": "craft\\controllers\\StructuresController",
            "type": "->"
        },
        {
            "file": "/mnt/data/www/tepari.cms/vendor/yiisoft/yii2/base/Module.php",
            "line": 552,
            "function": "runAction",
            "class": "yii\\base\\Controller",
            "type": "->"
        },
        {
            "file": "/mnt/data/www/tepari.cms/vendor/craftcms/cms/src/web/Application.php",
            "line": 349,
            "function": "runAction",
            "class": "yii\\base\\Module",
            "type": "->"
        },
        {
            "file": "/mnt/data/www/tepari.cms/vendor/craftcms/cms/src/web/Application.php",
            "line": 650,
            "function": "runAction",
            "class": "craft\\web\\Application",
            "type": "->"
        },
        {
            "file": "/mnt/data/www/tepari.cms/vendor/craftcms/cms/src/web/Application.php",
            "line": 311,
            "function": "_processActionRequest",
            "class": "craft\\web\\Application",
            "type": "->"
        },
        {
            "file": "/mnt/data/www/tepari.cms/vendor/yiisoft/yii2/base/Application.php",
            "line": 384,
            "function": "handleRequest",
            "class": "craft\\web\\Application",
            "type": "->"
        },
        {
            "file": "/mnt/data/www/tepari.cms/web/index.php",
            "line": 17,
            "function": "run",
            "class": "yii\\base\\Application",
            "type": "->"
        }
    ]
}

Craft CMS version

5.0.4

PHP version

8.2.18

Operating system and version

Mac 14.4.1 - DDEV

Database type and version

MySQL

Image driver and version

Imagick 3.7.0

Installed plugins and versions

"craftcms/ckeditor": "4.0.3", "craftcms/cms": "5.0.4", "craftcms/commerce": "5.0.0-beta.3", "craftcms/commerce-stripe": "5.0.1", "craftcms/google-cloud": "2.2.0", "doublesecretagency/craft-cpcss": "3.0.0", "doublesecretagency/craft-cpjs": "3.0.0", "embed/embed": "^v4.4.10", "ether/simplemap": "5.0.0", "mmikkel/cp-field-inspect": "2.0.1", "nystudio107/craft-retour": "5.0.0", "nystudio107/craft-seomatic": "5.0.2", "php-ffmpeg/php-ffmpeg": "^1.2", "spicyweb/craft-batch-actions": "2.0.0", "spicyweb/craft-embedded-assets": "5.0.1", "verbb/field-manager": "4.0.0-beta.1", "verbb/formie": "dev-craft-5 as 3.0.0-beta.4", "verbb/hyper": "2.0.0-beta.8", "verbb/icon-picker": "3.0.0-beta.3", "verbb/image-resizer": "4.0.0-beta.1", "verbb/tablemaker": "5.0.0-beta.2", "verbb/timber": "2.0.0-beta.2", "vlucas/phpdotenv": "^v5.6.0", "yiisoft/yii2-redis": "^2.0"

benfeather commented 6 months ago

Turns out to be a session-related issue. After clearing all browser data and cms cache, it started working.

brandonkelly commented 6 months ago

We’ve seen this happen when PHP sessions aren’t configured properly for load-balanced environments. Your authorization to move entries around is stored in your PHP session data, and then if the move request hits a different web server, that web server will think you’re not authorized.

Here’s some options for how to store PHP sessions across all servers: https://craftcms.com/knowledge-base/configuring-load-balanced-environments#php-sessions