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

Allow null group assignment for users #867

Closed
lcharette opened this issue Mar 28, 2018 · 5 comments
Closed

Allow null group assignment for users #867

lcharette opened this issue Mar 28, 2018 · 5 comments
Assignees
Labels
core feature request Feature request
Milestone

Comments

@lcharette
Copy link
Member

This will probably require a db migration to allow nullable value. The UI need to be allow for a "no group" option.

(Ref #843)

@lcharette lcharette added the core feature request Feature request label Mar 28, 2018
@lcharette lcharette added this to the 4.2.0 milestone Mar 28, 2018
@lcharette lcharette modified the milestones: 4.2.0, 4.3.0 Oct 13, 2018
@lcharette lcharette modified the milestones: 4.3.0, 4.4.0 Jan 14, 2019
@amosfolz
Copy link
Contributor

amosfolz commented Apr 8, 2019

Since this will require another DB migration I thought it might be good to include it in the same release as #957 since that will require one as well. If there are no problems I will start working on it.

@amosfolz
Copy link
Contributor

amosfolz commented Apr 9, 2019

I am running into some problems trying to figure out the best way to handle this. I am running into foreign key constraints from the relationships added here https://github.com/userfrosting/UserFrosting/blob/master/app/sprinkles/account/src/Database/Migrations/v420/AddingForeignKeys.php#L44

Even if we make the users.group_id column nullable, we will not be able to save a value unless it also exists in the groups.id
image

@lcharette
Copy link
Member Author

That's because the group_id is 0 while it should be null.

See : https://stackoverflow.com/a/15082906/445757

@amosfolz
Copy link
Contributor

That's because the group_id is 0 while it should be null.

See : https://stackoverflow.com/a/15082906/445757

Can we use value="0" on the form, then in the controller do a check? Something like this right before the update is made:

       if ($data['group_id'] == 0) {
           $data['group_id'] = null;
       }

Otherwise validation fails if group_id is not a integer.

amosfolz added a commit to amosfolz/UserFrosting that referenced this issue May 11, 2019
amosfolz added a commit to amosfolz/UserFrosting that referenced this issue Jun 15, 2019
amosfolz added a commit to amosfolz/UserFrosting that referenced this issue Jun 19, 2019
@lcharette lcharette modified the milestones: 4.4.0, 4.3.0 Jun 25, 2019
amosfolz added a commit to amosfolz/UserFrosting that referenced this issue Jul 11, 2019
amosfolz added a commit to amosfolz/UserFrosting that referenced this issue Jul 11, 2019
amosfolz added a commit to amosfolz/UserFrosting that referenced this issue Jul 11, 2019
lcharette added a commit that referenced this issue Jul 12, 2019
Allow null group assignment for users (Issue #867)
@amosfolz
Copy link
Contributor

Was addressed in #964.

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

No branches or pull requests

2 participants