Integration with Open-Xchange capabilities

Hello,

I am working on the UCS integration of our plugin for Open-Xchange appsuite, which includes a few OX capabilities that we need to be able to set/unset via the UCS interface. I’m currently considering how to technically go about that. I imagine it would be best to handle this in the same way that the OX integration handles it, but I’m not sure how it does (is the source available to inspect somewhere?).

Is there already an interface for handling OX capabilities via UCS, including authenticating in OX for the RMI jobs and such, or otherwise a method for how best to do that?

Cheers,
Pontus Horn

Hi,

there is a generic way to modify any configuration file in the /opt/open-xchange/etc directory via UCR variables. These UCR variables can be set during the package installation, via command line or the UMC web interface. The variables consist of a prefix “ox/cfg”, the name of the configuration file in the “/opt/open-xchange/etc” directory, a property and a value for the property:

 -> ucr set ox/cfg/CONFIG_FILENAME/PROPERTY=VALUE

Example:

-> more /opt/open-xchange/etc/permissions.properties| grep permissio
# Default permissions for all users
permissions=

-> ucr set ox/cfg/permissions.properties/permissions=myplugin

-> more /opt/open-xchange/etc/permissions.properties| grep permissio
# Default permissions for all users
# Warning: the value "permissions" has been set via UCR variable "ox/cfg/permissions.properties/permissions" - please alter the UCR variable instead
permissions=myplugin

More information on how to set, unset, get UCR variables can be found in the developer reference docs.univention.de/developer-ref … sage:shell

The integration packages of apps normally handle this kind of configuration in the debian/postinst script of the package, e.g.

#!/bin/bash

#DEBHELPER#

if [ "$1" = "configure" ]; then

    module=myplugin
    # get the current value
    permissions="$(ucr get ox/cfg/permissions.properties/permissions)"

    # check if module is already set
    if [[ "$permissions" == *"${module}"* ]] ; then
        echo "OX permission '$module' already set"
    else
        echo "Adding OX permission '$module'"
        # "${foo:+,}" evaluates to "," if variable foo is non-empty
        ucr set ox/cfg/permissions.properties/permissions="$(echo "${permissions}${permissions:+,}$module")"
    fi

    ... more configuration ...

    # restart open-xchange
    [ -x "/etc/init.d/open-xchange" ] && invoke-rc.d open-xchange restart
fi

Best regards,
Felix Botner

I realised I forgot to reply here; I just carried on the email chain instead. Sorry about that.

Is there a way to listen for changes to UCR variables and run scripts after that? Can it be done with a directory listener, for example, or is that outside their scope?

Hi,

yes, this is possible. When a UCR variable is set, one can either call a script or rebuild a file (or both). It is documented here: docs.univention.de/developer-ref … l#ucr:info

Regards,
Dirk Wiesenthal

Thank you!

Mastodon