getgrav / getgrav/grav-plugin-admin

Deleting a group doesn't update members' accounts

Open
#2,258 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
PHP
Stars
377
Forks
225
Avg merge
11h 51m
Merged PRs (30d)
4

Description

If you have a group, say "VIP", with a few members and you delete the group, the members' account YAML files will still contain

```
groups:
- VIP
```
This means that if you have custom code that reads group membership directly from the YAML files, you have to also read the `/user/config/groups.yaml` file to check if the group actually exists and is enabled. Also, if you create a group and assign it certain permissions, not knowing that a group with the same name previously existed, you may unknowingly have some group members that are not supposed to have those permissions.

Shouldn't deleting a group also delete the group from all group members?

I have checked the behavior in Grav 1.7.31 and Admin Panel 1.10.31 and see no related PRs or issues.

Edit: I didn't think about the case when a group is disabled but not deleted. Then it doesn't make much sense removing the group from all members, since you'd have to resubscribe them all after enabling the group again. Having users that are members of a disabled group is at least conceptually more pleasing than them being members of a group that doesn't exists, but poses the same practical issues (forcing you to inspect the groups.yaml file when evaluating group membership).

Contributor guide

Open the contributing guide

Research direction

Reproduce the case using /user/config/groups.yaml and the affected members' account YAML files, then trace the group-deletion entry point in the Grav Admin Plugin. Compare deletion with disabling a group, since the issue distinguishes those behaviors. Done means deleted groups no longer remain in member accounts while disabled-group membership follows the agreed behavior, with regression coverage added if the project has a relevant test location.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, yaml
Domain
authorization, backend
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.