[horde] Kronolith default_share Nag default_tasklist and turba default_dir values

Jean-Philippe PIALASSE tests at pialasse.com
Fri Mar 27 04:10:28 UTC 2020


Dear all,

I am working on a rpm based installation of Horde 5 on  a distribution
called Koozali SME Server 10. We are basing this on a CentOS 7 system.

SME Server is using Horde 3 in its previous version for quite a while. I
am working on customisation of the connexion between the server user
base and Horde. I managed to use somme hook  in order to :

- use a username without any domain  as Horde uid (pref_uid) using
authusername hook

- populate Full name from server ldap  using prefs_init hook

- populate the default email depending on the context (other the primary
domain of the server of the virtualhost it has been accessed from) using
prefs_init hook

We also use an imap connector to identify our users.

I am trying to find a way to force the creation of default Kronolith
share and Nag tasklist .... using the username as share_name. This was
how it was done with Horde 3, and while I see the advantage of a random
string in most environments, here we will only have users connected with
their own username (no risk of username conflict) , and having the
ability to use an easy to memorize url to access their calendar would be
appreciated.

From there I have tried with Kronolith without success :

1- added to config/kronolith/prefs.local.php

<?php
$_prefs['default_share']['hook'] = true;
?>


2 - tried config/kronolith/hooks.php

class Kronolith_Hooks
{
    public function prefs_init($pref, $value, $username, $scope_ob)
    {
        if (is_null($username)) {    // not logged in
            return $value;
        }

        switch ($pref) {
         case 'default_share' :
            error_log( "hook prefs_init default_share");
            return $username;
            break;
        }
    }
}


The hook is called as I can see it logged, but even with a new user I
get everytime a random string as share name.


I feel there is something to do rather with this part of de
default_share definition, but I do not see how to do:

    'on_init' => function($ui) {
        $enum = array();
        foreach (Kronolith::listInternalCalendars(false,
Horde_Perms::EDIT) as $id => $calendar) {
            $enum[$id] = Kronolith::getLabel($calendar);
        }
        $ui->prefs['default_share']['enum'] = $enum;
    },
    'on_change' => function() {
        $GLOBALS['injector']->getInstance('Kronolith_Factory_Calendars')
            ->create()
            ->setDefaultShare($GLOBALS['prefs']->getValue('default_share'));
        $sync = @unserialize($GLOBALS['prefs']->getValue('sync_calendars'));
        $haveDefault = false;
        $default = Kronolith::getDefaultCalendar(Horde_Perms::EDIT);
        foreach ($sync as $cid) {
            if ($cid == $default) {
                $haveDefault = true;
                break;
            }
        }
        if (!$haveDefault) {
            $sync[] = $default;
            $GLOBALS['prefs']->setValue('sync_calendars', serialize($sync));
        }
    }


Thank you for any input.


Jean-Philippe

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4052 bytes
Desc: Signature cryptographique S/MIME
URL: <https://lists.horde.org/archives/horde/attachments/20200327/3040f300/attachment.bin>


More information about the horde mailing list