[horde] Sharing user information between hooks

Jan Schneider jan at horde.org
Mon Oct 5 13:02:24 UTC 2015


Zitat von Michael J Rubinsky <mrubinsk at horde.org>:

> Quoting Jens Wahnes <wahnes at uni-koeln.de>:
>
>> To customize the user experience, we are using hooks in our Horde
>> installation.  Among others, we are using preauth-Hooks both within the
>> "horde" scope (.../config/hooks.php) and within the "imp" scope
>> (.../imp/config/hooks.php).  So far, these hooks work completely
>> independent from each other.  However, we would like to change that and
>> access information that has been generated by Horde's preauth hook from
>> within IMP's preauth hook.  What is the best way to share such
>> information between these hooks?  Should I add some key-value pair to
>> the user's session?  If so, how should I go about that?  Should I use
>> PHP's $_SESSION variable?  Or is there a preferred way to do that
>> through some interface the Horde framework provides?
>
> IIRC, depending on the context, it's possible for the preauth hooks  
> to be executed before the session is created, so you may or may not  
> be able to utilize the horde session within those hooks. For the  
> record, though, you should access the session using the  
> $GLOBALS['session'] object, not the raw php $_SESSION variable.
>
>>
>> BTW, another thing I noticed with the last "pear upgrade" is that the
>> .../imp/config/hooks.php file gets overwritten.  This applies to IMP's
>> hooks.php only - it does not happen with Horde's hooks
>> (.../config/hooks.php).  Is that on purpose or is it a bug?
>
> I don't see how this would be possible. From PEAR's point of view,  
> there is no hooks.php file - only hooks.php.dist.

No, this happens indeed if using Horde Groupware, because it ships  
with a preconfigured hooks.php.

-- 
Jan Schneider
The Horde Project
http://www.horde.org/



More information about the horde mailing list