User class(es)
| From: | Benjamin R. Webb | Date: | Thu, 26 Apr 2001 06:46:31 +0000 |
| Subject: | User class(es) | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-321@lists.php.net to get a copy of this message | ||
For a portal project I'm working on I'm going to
be developing a triad of user management classes.
The first class will be an admin class and will have methods such as
add/delete user, reset password, grant/revoke user permissions,
and activate/deactivate user.
The second class will be a user manager class and a factory for the third
class. This class will have methods such as set email address, set real
name, set prefrences, and other "user" type data. It will also have an
auth method. The auth method will authenticate and upon sucess, will
return an instance of the third class (as well as set an internal variable
that will be required for any of the other functions to work).
The third class will be a small class with simple methods like get real name,
check prefrences, check permissions, list prefrences, get email address, etc...
the point of this class will be that it could be registered with
session_register() and kept persistent throughout the session. The practicle
upshot is that the user information is available in a easy, intuative way.
For an example, let's say I support two displays for my portal, with icons and
without (as in Slashdot). With this class I could simply
if (s_user->checkPrefs("icon")) {
... show the icon ...
}
Once I have this done, I'll submit it for discussion. Does anybody have any
thoughts/critisisms (other than my spelling :-)) about this idea/architecture?
Thanks,
Ben