Inside the Horde

Jan Schneider

The Horde Project

Administrator GUI tools

Let's start with something easy to get warm. A quick run through the administration tools.

Demonstration

  • Setup
  • Users
  • Groups
  • Permissions
  • Alarms
  • Sessions
  • PHP Shell
  • SQL Shell
  • CLI

7 Ways of Customization

  • Themes
  • Configuration
  • Preferences
  • Permissions
  • Hooks
  • APIs
  • Drivers

Themes

  • Easy way to change look, to create a CI
  • Consist of CSS rules and an optional icon set
  • "Traditional" applications more or less colors and fonts
  • "Modern" applications like DIMP completely CSS rendered
  • Real cascading through hierarchical CSS file loading

Configuration

  • All configuration files go into the application's config/ directory: conf.php, prefs.php, mime_drivers.php, application specific files
  • Note: all configuration files are PHP code
  • Virtual host specific configuration
    • Set $conf['vhosts'] = true
    • Go to http://www.example.com/
    • Horde loads config/conf.php, config/www.example.com-conf.php, etc

Advanced Configuration Examples

Custom login or logout pages

  • Not that advanced actually
  • Redirect on unauthorized access
  • Redirect on logging out
  • Enabled in Horde or IMP configuration, depdending on authentication
  • $conf['auth']['alternate_login'] = 'http://www.example.com/mylogin.php';
  • Example script for IMP in imp/scripts/cutom_login.php

Advanced Configuration Examples

Custom email headers, signatures, trailers

  • Track users (spammers)
  • Identify machines (in a cluster)
  • Add company signature, disclaimer
  • Keep user signatures flexible (changing offices, positions, numbers)

Advanced Configuration Examples

Composite authentication

  • Different authentication drivers for different purposes (authentication, user management/listing)
  • Example:
    • Want to have view switch on login screen → IMP authentication
    • Want to have signups → SQL authentication
  • See http://wiki.horde.org/AuthCompositeHowTo for detailed instructions

Preferences

  • Defined in config/prefs.php
  • Individual preferences in $_prefs, grouping in $prefGroups
  • Grouping just cosmetical

Preferences

  • Actual preference
  • Preference types: checkbox, number, text, password, etc.
  • More preference stuff later with hooks

Permissions

  • Who?
    • Guests, anyone
    • Authenticated users
    • Individual users
    • Groups
    • Object owners
  • What?
    • Show
    • Read
    • Write
    • Delete
    • (Delegate)

Permissions

  • Where?
    • Application access
    • Application-level limits
      • Maximum number of resources (folders, events, contacts, etc)
      • Access to resources (address books)
      • Feature limitiation (creating folders)
  • How?
    • Go to the permissions screen in the administration area
    • Add permissions for an application
    • Remember to set permissions, default is no access for anyone
    • Add sub-permissions, that's where the cool stuff is

Hooks

The swiss army knife of Horde manipulation

  • Preference hooks
    1. Reading default preference values (lock them?)
    2. Called when saving preferences
  • Pre-authentication/post-authentication hooks
  • and more...
  • Application-specific hooks

Preference Hook Examples

Classics: email address, full name

Preference Hook Examples

Real world example: custom preferences through web service

Authentication Hook Example

Real world example: force users to accept a TOS and change passwords on login

Code

Signup Hook Example

Real world example: request preference defaults, enforce TOS, normalize user names

Code

More Hooks

More hooks and possible use cases

  • User name hooks (_username_hook_frombackend, _username_hook_tobackend, _imp_hook_vinfo)
    • Normalize user names (all lower-case)
    • Strip and add domains
    • Conversion between user IDs and user names
  • Group hooks (_group_hook)
    • Dynamically determine group membership

Application Hooks

  • IMP
    • Mailbox listing (show attachment icons, parse X-Priority headers)
    • Filter fetchmail messages
    • Add/change trailers and signatures
    • Display special mailbox icons
    • Quota driver
  • DIMP
    • Mailbox listing (show attachment icons, parse X-Priority headers)
    • Modify message view/preview

Application Hooks

  • Turba
    • Encode/decode contact attributes (massage values for output/storage, hashing/hiding passwords)
  • Nag/Mnemo
    • Description formatting

APIs

  • All inter-application communication through APIs
  • Replace one application with another, just implement the API
  • Examples:
    • Have your own blacklist/whitelist solution? Implement API methods mail/blacklistFrom, mail/showBlacklist, etc.
    • Have your own address book application? Implement the contacts API.
    • Want to integrate a different ticket system than Whups? Write a wrapper around Bugzilla/OTRS implementing the tickets API.

APIs

Registering an application at the Horde registry config/registry.php:

APIs

Create an API definition in lib/api.php:

APIs

Using APIs to use Horde functionality in your own applications

  • RSS feeds
  • Embeddable widgets

APIs

Using APIs to use Horde functionality in your own applications

  • Direct PHP API calls through registry More documentation on the wiki: http://wiki.horde.org/Doc/Dev/Registry
  • Use http://www.example.com/horde/rpc.php as an endpoint for
    • SOAP
    • XML-RPC
    • JSON-RPC
    • WebDAV

Drivers

  • Your favorite backend for a library or application is not supported?
  • Create a driver!
  • Take an existing driver as a blueprint
  • Start hacking
  • Examples:
    • New authentication driver: lib/Auth/mydriver.php
    • New address book driver. turba/lib/Driver/mydriver.php

Questions?

Resources

Obrigado!