LiveUserPEAR::LiveUser authentication and permission framework |
[ AdvancedSearch | AreaMap ]
|
| Welcome to LiveUser | Documentation | RoadMap | Wishlist | About |
| Documentation | FAQ | References | Tutorials | Other |
|
Areas In LiveUser |
*IMPORTANT* The observers mechanism was modified to use the new package Event_Dispatcher in version 0.15. If you were using observers with version 0.14 please check this example and update your code accordingly When using an authentication and permission management one might need to implement custom functionalities. Since it is impossible to provide all features as built-in Matthias Nothhaft stepped up and implement observers into LiveUser. Observers will be notified about key changes of state in the LiveUser object. Observers make it possible to extend the feature LiveUser provide to implement any scheme you may have. You can use observers to have added security upon login (IP address restrictions), improve the data gathering process (upon login you can save the data) and several other possibilities. There are no limits to what you can do, an observer is a simple class or function which gets notified when an event is triggered. An observer code example is shown below. Events list
How to use observersAn observer will receive a notification object. Using observers is done via a simple call to a public method of the LiveUser class. One method is available to attach observers: $liveuser_object->dispatcher->addObserver expects a PHP callback. That means you may either pass a function name as a string or an array containing an object or class and a method to call. See this for further explanation. Observer class example
How to add new eventsIf you write a class which extends LiveUser you can use the following code
This site powered by YaWiki 0.22 beta. |
|