[horde] Setting up identities in hooks

Diego Woitasen diegows at xtech.com.ar
Sat May 8 19:47:04 UTC 2010


Hi,
 I'm using Horde Groupware (Kolab). I need to setup user identities every
times the user logins. The informatino is stored in LDAP. I know that
config/hooks.php is the place to put the code, the code is executed but I
don't underdand why my modifications to identities and sent to /dev/null.

The example code with LDAP that doesn't work.

if (!function_exists('_horde_hook_postauthenticate')) {
    function _horde_hook_postauthenticate($userID, $credential, $realm) {
        require_once 'Horde/Identity.php';
        $name = "$userID";
        if (is_null($name)) {
            $name = Auth::getAuth();
        }

       Horde::logMessage('Setting up identities.');

        $identities = &Identity::singleton('none',"$name");
        $identities->init();

        $id_data = array( "id" => "Uno", "fullname" => "Full Uno",
                        "from_addr" => "uno at kolab-demo.xtech.com.ar");
        $identities->add($id_data);

        $id_data = array( "id" => "Dos", "fullname" => "Full Dos",
                        "from_addr" => "dos at kolab-demo.xtech.com.ar");
        $identities->add($id_data);

        $id_data = array( "id" => "Tres", "fullname" => "Full Tres",
                        "from_addr" => "tres at kolab-demo.xtech.com.ar");
        $identities->add($id_data);

        $identities->setDefault(0);

        $identities->save();

        return true;
    }

Any ideas?

Thanks!

-- 
Diego Woitasen
XTECH


More information about the horde mailing list