psecio / gatekeeper

Gatekeeper: An Authentication & Authorization Library
367 stars 23 forks source link

User registration with groups inserts odd rows #60

Open Swader opened 8 years ago

Swader commented 8 years ago

When I put this POST data directly into the Gatekeeper::register method:

screenshot 2016-03-13 09 12 03

Then my records go from this:

screenshot 2016-03-13 09 08 27

to this:

screenshot 2016-03-13 09 10 04

and I also get an additional MySQL error: DB ERROR: [23000] Duplicate entry '1-12' for key 'group_id'

In other words, when inserting this data, GK not only tries to insert a group-user pair twice, it also for some reason grabs the ID of the last inserted user-group pair row and uses that ID as the next user ID.

Am investigating further.

Swader commented 8 years ago

Note that things work just fine if I first save the user, then iterate through the group IDs and use them as addGroup on the user instance.