cms icon indicating copy to clipboard operation
cms copied to clipboard

[4.x]: Revoking permissions from user group via project config does not work if all permissions in group is revoked

Open aelvan opened this issue 1 year ago • 4 comments

What happened?

Description

When removing permissions from a user group, and pushing project config changes to a different environment, it's not possible to completely remove all permissions in a group of permissions (for instance "Users"). If one or more permissions is set, they are updated correctly.

Steps to reproduce

  1. Create a user group with some Users permissions set. CleanShot 2023-02-28 at 10 12 17

  2. Push updated project config to an environment that applies these changes.

  3. Change permissions by completely removing all permissions within a permissions group. CleanShot 2023-02-28 at 10 13 55

  4. Push updated project config to an environment that applies these changes.

Expected behavior

The user group should have no permissions to Users.

Actual behavior

The user group have the permissions previously set.

If I keep at least one permission checked in the permissions group, everything works as expected. CleanShot 2023-02-28 at 10 16 24

Craft CMS version

4.3.10

PHP version

8.1.5

Operating system and version

MacOS 11.2

Database type and version

Mysql 5.7 (local) / 8.0 (prod)

Image driver and version

Imagick 3.7.0

Installed plugins and versions

No response

aelvan avatar Feb 28 '23 09:02 aelvan

Hi, thanks for reaching out. I’m having trouble replicating it on a fresh Craft 4 install.

When applying your changes, did you try using the --force flag (php craft project-config/apply --force) or “Reapply everything” if you’re applying via the Control Panel? Is the outcome still the same - permissions for the user group not getting updated?

i-just avatar Feb 28 '23 14:02 i-just

Hey there, applying this with craft project-config/apply --force does work. But I'd still mark this as a bug, as it will not apply the correct project config without forcing it, although it was changed.

maxstrebel avatar Aug 04 '23 09:08 maxstrebel

+1 this because i ran into the same problem today using craft 4.4.16

PHP version | 8.1.22 MySQL 43 Craft Pro 4.4.16.1 yii version 2.0.47

project-config/apply --force did the trick but obviously I do not want to do this each time i want to disable a usergroups permissions to access a specific section.

Numkil avatar Aug 04 '23 12:08 Numkil

Thanks all!

When it happens again, could you please send composer.json, composer.lock, and database export from the environment you’re applying project config changes to (before attempting to apply them) and the project/config folder with the changes you’re trying to apply to [email protected]?

i-just avatar Aug 16 '23 06:08 i-just