Another User Management Auth ACL Fancy Stuff Something Something library |
[eluser]davidbehler[/eluser]
Hey, it's been quite a while since I've updated my auth library and today at work I had some idle time and started thinking about a new one. There have been many discussions on what an auth/acl/whatever library should provide and wether we should distinguish between authentication, permission checking, registration, general user management and so on or put it into one library that handles everything. I, for my part like having a library that handles everything that's needed to authenticate a user (e.g. login/logout) and check his permissions (e.g. ACL). The other stuff (registration, activation,...) is mostly done by one of my controller in combination with a model. There is no real reason why I've seperated these parts, propably because of my projects that use to differ widely in that part. The other topic that's often discussed is how customizable a library should be and what parts should follow certain standards that would allow easy exchange of libraries (see here for a discussion on that topic started by xwero). Anyway, after not as much thinking as I would like to have put into this, I came up with a first draft of my new auth library: Code: <?php There isn't much functionality yet, but I guess you can see where this is headed: Easily customizable/extendable library that covers authentication/acl stuff/user management stuff. Using adapters (I "stole" this term from Zend) it's possible to allow for as many ways of authentication as you want. Database access, LDAP, predefined sets of username and password, Facebook, OpenID, OAuth? Everything is possible, as long as you got a fitting adapter If you carry the idea a bit further, you could add other adapters for session storage (database, cookie, php session, ...), registration and every other process you can think of. Sure, one might overdo things by using adapters for every aspect but I'm only saying it's possible There is still alot of work to do to make really makes this library work and that's exactly the reason for me to post here now, before I've even really started working on it: I want to hear your opinion on this! What do you think of this approach? Do you think it's worth the time? I would not do this for me, altruistic as I am, but rather for the community! Nearly every day there is someone asking for an auth library. Wouldn't it be nice to have one library that fits all their needs and if it doesn't can be easily extended? Tell me what you think! I'm looking forward to your comments! Greetz, waldmeister
[eluser]Milos Dakic[/eluser]
Code: return call_user_func_array(array($this->adapater, method), arguments); I think that should be: Code: return call_user_func_array(array($this->adapater, $method), $arguments); Other then that, I'd say the permissions stuff can be put into another library, so your left with "login, logout & register". Maybe add a "deactivate" one as well, which can be used for removing/deleting/deactivation user accounts.
[eluser]davidbehler[/eluser]
Did you read the text surrounding the code tags? I put all that stuff in there on purpose! I'm aiming at a library that does everything to avoid having multiple libraries that all deal with user authentication, permission checking and so on.
[eluser]Milos Dakic[/eluser]
"Auth" seems to be more specific to authentication (login,logout etc). And yes I did read the text, I just thought I'd mention it =] I do like the code structure though, as I have been trying to do something like this for a while. Hopefully one day I'll get around to finishing it off.
[eluser]davidbehler[/eluser]
I see. I changed the class name, maybe that helps
[eluser]darkhouse[/eluser]
I like this, I just finished building an authorization system with roles/resources, but I did not incorporate the ability to run other "adapters", I'm thinking down the road I should convert what I've done into an adapter, and use this to manage everything. Thanks!
[eluser]darkhouse[/eluser]
I just wanted to mention that I finally used this class the other day, and it worked great. I used it for applying different shipping adapters to a store that I'm working on. It made life so much easier, at first I wasn't sure how I'd tackle it, but I remembered this class, and that was the solution. There are a few syntax and spelling errors, but they're minor, and once they're fixed, it all works great. One of those issues was this line: Code: $this->adapter = new $class_name($this->_raw_config[strtolower($adapter)]); Code: $this->adapter = new $class_name(); I was able to load config files for each of my shipping adapters as they all have different settings and requirements, and I was able to keep those config files in a shipping folder within the config folder, just for organization. Again, thanks for this great work, I don't know what I would've done without it. |
Welcome Guest, Not a member yet? Register Sign In |