Comments (4)
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.
from gatekeeper.
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.
from gatekeeper.
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 =)
from gatekeeper.
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.
from gatekeeper.
Related Issues (20)
- documentation HOT 1
- Rename setup.sh HOT 1
- Setup should check if vars exist, not just append
- Add ability to use alternative models HOT 1
- Problem with Throttling
- Re-apply groups
- Add soft delete
- Relations HOT 1
- User registration with groups inserts odd rows HOT 1
- hasPermission() function always return false HOT 2
- Setup won't complete using remote database
- created Field being updated when model is updated (saved)
- Test on PHP 7 HOT 1
- no idea how to setup gatekeeper
- Issue at install (Solved) HOT 3
- Can user change their password?
- How use Token Id Session how current session?
- setup.sh HOT 1
- Does anyone actually use this? HOT 3
- find[ByXXXXX] not returning anything HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gatekeeper.