Skip to content

[6.x]: alpha.11 Custom permissions not getting saved #19232

Description

@white-lukas

What happened?

Description

I created a Listeners class in the app/Listeners directory with the following function

public function handle(UserPermissionsResolving $event): void
    {
        $event->permissions = $event->permissions->push(new PermissionGroup(
            heading: 'Custom Permissions',
            permissions: collect([
                new Permission(
                    key: 'permission 1',
                    label: 'Permission 1',
                    nested: collect([
                        new Permission(
                            key: 'nestedPermission',
                            label: 'Nested Permission',
                        ),
                    ])
                ),
            ]),
        ));
    }

Those custom permissions do show up in on the user page, but when selecting the permissions and saving the user (or user group) those permissions are not persistent.

It looks like that when the Facade class is getting called (https://github.com/craftcms/cms/blob/6.x/src/Http/Controllers/Users/PermissionsController.php#L213) the event is not getting triggerd which removes the custom permissions

Steps to reproduce

  1. Add custom permissions
  2. save user with new permissions
  3. refresh the user page
  4. permissions are unset

Expected behavior

Custom permissions are set after saving

Craft CMS version

6.0.0-alpha.11

PHP version

8.5

Operating system and version

No response

Database type and version

No response

Image driver and version

No response

Installed plugins and versions

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions