Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-apply groups #57

Open
Swader opened this issue Mar 12, 2016 · 0 comments
Open

Re-apply groups #57

Swader opened this issue Mar 12, 2016 · 0 comments

Comments

@Swader
Copy link
Contributor

Swader commented Mar 12, 2016

In typical user management CRUD apps, it's a common case to have to remove users from a group or add them to them - it would be easier if we could do this like so:

$user->changeGroups($_POST['groups']);

Right now, we have to:

  1. Get group IDs from a form
  2. Compare with current group IDs on a user
  3. Revoke any that no longer appear in data from form
  4. Add any new ones that appear in data from form

This is, for obvious reasons, incredibly impractical.

I suggest implementing a new changeGroups method which would remove ALL groups from a user, and at the same time add those we're feeding it. The method should be wrapped in a transaction in order to be safe against failures and leaving a user without groups should something break mid-way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant