Lookup Stack API
Over View
The lookup stack is created and there is a function for user lookup
The lookup stack interacts with the plugins by callback functions for various sections. These callbacks are registered with the lookup stack by the plugins when they are initilaised during the lookup stack construct process. The callback function is given an object and is expected to return this object when it finishes after adding/modifying things which will then be parsed to the next callback function, it will generally have things in it set before being parsed to the first registered callback for this section.
The sections are init:: extra startup routines preuserlookup:: extra routines to run before looking user up userlookup:: routines to lookup user(s) usertranslatelookup:: routine run after each userlookup callback to translate and run any special rules. postuserlookup:: extra routines run after the main lookup has completed
The process is given in more detail below
How the Lookup Stack Works
Startup
First the Lookup class object is constructed
This loads the configuration from the config Object.
Initiate plugins
A loop is made going through each plugin in the authentication config.
Lookup Init Object is created.
it runs the apicheck function if this says they are compatible then it will run the init function, after this it will run the register_callback_routines function. The data from this function is then parsed onto the register_callback function
User Lookup
The userlookup function is called with a userlookupdata object with all known data set & the settings for the lookup set in , this is the start of the lookup procedure.
it checks the userlookupdata object ($data) for a searchordesr or a settings->searchorder) and if not found applies the default ('username', 'studentID', 'staffID', 'email', array('surname', 'firstname'))
if there is no lookupdata in the object it gives up
PreUserlookup
This is run with a preuserlookup object
UserLookup
This is run with a userlookup object after each pass through this it will run a callback on the usertranlatelookup which gets parsed the returned userlookup object
It then checks the the $data->setttings for recrsive_search_order and if so will run through each lookup to resolve info about them, and the recursive_override to see what should be overriden by later lookups there is a maximum dept of $data->settings->recursive_max
After this:
PostUserLookup
This is run with a postuserlookup object after this is run it checks if the lookups failed or not and sets the appropriate quick check flags, it then sees if it got multiple results and if so sets the unreliable flag.
it then returns the userlookup object that is the expanded $data