craftcms / craftcms/cms

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

Open
#12,756 4 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug craft4
Dominant language
PHP
Stars
3.6k
Forks
705
Avg merge
1d 5h
Merged PRs (30d)
134

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the project-config deployment described for Craft CMS 4.3.10, comparing a permissions group with one selected permission against a group with none. Trace the user-group permission update path and verify that the deployed configuration removes previously granted Users permissions; done means the target group has no Users permissions after the second push.

Written by the indexing model from the issue text.

Assessment

Tech stack
mysql, php
Domain
authorization
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.