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

Too few fields for users #19

Open
Ser5 opened this issue Jul 15, 2015 · 4 comments
Open

Too few fields for users #19

Ser5 opened this issue Jul 15, 2015 · 4 comments

Comments

@Ser5
Copy link
Contributor

Ser5 commented Jul 15, 2015

As I can see here:
http://gatekeeper-auth.readthedocs.org/en/latest/users/#creating-users
there is login, password, first name and last name fields, plus some technical info like id, resetCode, created etc.

Usually a ton more of fields is required.
Today I tried to import some data into users table and found that there is too few fields for a name - only first and last. We here, at Russia, have one more name - you can call it "Middle name", "Second name" or "Patronymic". I think, "middle_name" or "middleName" would be OK for database. One can't store someone's name without a middle name.

Often developers have to store much more additional information, like work phone, mobile phone, web site address, company name and others. Is there a solution for this? Is any work planned to address this issue?

@enygma
Copy link
Member

enygma commented Jul 15, 2015

Good point - the library this was modeled after (Sentry) only had a few user fields in it. I think it's definitely reasonable to add a "user attributes" kind of setup to allow for much more flexible user details to be stored along with the core information. I'd say that username, password, email and things like that should stay in the users table but I could definitely see the attributes being used for other things.

@Ser5
Copy link
Contributor Author

Ser5 commented Jul 15, 2015

I can think of a few more ways of implementing additional fields. Don't know if they are "Gatekeeper-way" or easy to code, though.
1.) Most straightforward is inheriting UserModel, adding some fields to $properties variable, adding fields to database accordingly, then use Gatekeeper::init() to force usage of inherited class, something like Gatekeeper::init(blah, array('UserModel' => '\My\User\Model'))
2.) Make UserModel configurable, so one can pass his own array of properties to UserModel constructor. Then you pass configured UserModel to Gatekeeper::init(). Of course manual adjustment of users table is required too.
3.) Doctrine & Symfony2 way. You create your own User class containing any set of fields then say "Doctrine, use it, please", then magic occurs, users table modified automatically and everything works. Kind of. Both Doctrine and Symfony2 are too much complicated and I doubt that it will be easy to implement and use.

@Ser5
Copy link
Contributor Author

Ser5 commented Jul 15, 2015

0.) Mostest of the most simple variants: you add dozen more of fields into UserModel, enough for 99% of users - middleName, homeAddress, homePhone, workAddress, workPhone, mobilePhone etc - and make a new release =)

@Swader
Copy link
Contributor

Swader commented Feb 7, 2016

I would recommend against having non-auth info in Gatekeeper - you can easily extend the model and DB setup to have linked followup tables etc. Have a table in your own app logic like users_contact or users_personal etc and just link them to the gatekeeper tables - that way we keep GK lean, and you still get full flexibility for your app.

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

3 participants