gunnar: server/horde-turba Makefile, NONE, 1.1 conf.php, NONE, 1.1 config-sources.php.dist.patch, NONE, 1.1 horde-turba-kolab.spec, NONE, 1.1 lib-Driver-ldap.php.patch, NONE, 1.1 lib-Turba.php.patch, NONE, 1.1 lib-base.php.patch, NONE, 1.1 sources.php, NONE, 1.1

cvs at kolab.org cvs at kolab.org
Fri May 25 14:07:19 CEST 2007


Author: gunnar

Update of /kolabrepository/server/horde-turba
In directory doto:/tmp/cvs-serv18619

Added Files:
	Makefile conf.php config-sources.php.dist.patch 
	horde-turba-kolab.spec lib-Driver-ldap.php.patch 
	lib-Turba.php.patch lib-base.php.patch sources.php 
Log Message:
The horde-turba package.

--- NEW FILE: Makefile ---
RPM = /kolab/bin/openpkg rpm
HORDE_NAME = $(shell grep "%define[ ]*V_horde_name" *.spec | sed -e "s/.*V_horde_name \([a-z-]*\).*/\1/")
YEAR = $(shell grep "%define[ ]*V_year" *.spec | sed -e "s/.*V_year\s*\([0-9]*\).*/\1/")
MONTH = $(shell grep "%define[ ]*V_month" *.spec | sed -e "s/.*V_month\s*\([0-9]*\).*/\1/")
DAY = $(shell grep "%define[ ]*V_day" *.spec | sed -e "s/.*V_day\s*\([0-9]*\).*/\1/")

DATE = ${YEAR}-${MONTH}-${DAY}

PACKAGE = horde-$(HORDE_NAME)-kolab
VERSION = ${YEAR}${MONTH}${DAY}
RELEASE = $(shell grep "%define[ ]*V_release" *.spec | sed -e "s/.*V_release\s*\([0-9]*\).*/\1/")

PATCHES = $(shell find . -name "*.patch")
TEMPLATES = $(shell find . -name "*.template")
CONFIGS = $(shell find . -name "*.php")

ifeq "x$(KOLABRPMSRC)" "x"
  KOLABRPMSRC = /kolab/RPM/SRC
endif

# Remove once moving to kolab cvs
PACKAGE_0=$(HORDE_NAME)-HEAD-$(DATE).tar.gz
SOURCE_0=http://ftp.horde.org/pub/snaps/${DATE}/$(PACKAGE_0)

all:
	test -d $(KOLABRPMSRC)/$(PACKAGE) || mkdir $(KOLABRPMSRC)/$(PACKAGE)
	cd $(KOLABRPMSRC)/$(PACKAGE) && wget -c "$(SOURCE_0)"

	cp $(PACKAGE).spec $(KOLABRPMSRC)/$(PACKAGE)

	if [ -n "$(PATCHES)" ]; then              \
	  for PATCH in $(PATCHES);             \
	  do                                        \
	    cp $$PATCH $(KOLABRPMSRC)/$(PACKAGE);\
	  done;                                     \
	fi

	if [ -n "$(TEMPLATES)" ]; then              \
	  for TEMPLATE in $(TEMPLATES);             \
	  do                                        \
	    cp $$TEMPLATE $(KOLABRPMSRC)/$(PACKAGE);\
	  done;                                     \
	fi

	if [ -n "$(CONFIGS)" ]; then                \
	  for CONFIG in $(CONFIGS);                 \
	  do                                        \
	    cp $$CONFIG $(KOLABRPMSRC)/$(PACKAGE);  \
	  done;                                     \
	fi

	cd $(KOLABRPMSRC)/$(PACKAGE) && $(RPM) -ba $(PACKAGE).spec

dist: all
	cp $(KOLABRPMSRC)/../PKG/$(PACKAGE)-$(VERSION)-$(RELEASE).src.rpm ../stage/

binary:
	$(RPM) -bB $(PACKAGE).spec

--- NEW FILE: conf.php ---
<?php
/* CONFIG START. DO NOT CHANGE ANYTHING IN OR AFTER THIS LINE. */
// $Horde: turba/config/conf.xml,v 1.20 2006/05/09 14:22:18 jan Exp $
$conf['menu']['import_export'] = true;
$conf['menu']['apps'] = array();
$conf['client']['addressbook'] = 'kolab_local';
$conf['shares']['source'] = 'kolab';
$conf['comments']['allow'] = true;
$conf['documents']['type'] = 'horde';
/* CONFIG END. DO NOT CHANGE ANYTHING IN OR BEFORE THIS LINE. */

--- NEW FILE: config-sources.php.dist.patch ---
Index: config/sources.php.dist
===================================================================
RCS file: /repository/turba/config/sources.php.dist,v
retrieving revision 1.166
diff -u -B -r1.166 sources.php.dist
--- config/sources.php.dist	23 May 2007 22:08:54 -0000	1.166
+++ config/sources.php.dist	25 May 2007 11:01:12 -0000
@@ -736,6 +736,7 @@
             'version' => 3,
             'bind_dn' => '',
             'bind_password' => '',
+            'read_only' => true,
         ),
         'map' => array(
             '__key'             => 'dn',

--- NEW FILE: horde-turba-kolab.spec ---
# Versions
%define         V_horde_name turba
%define         V_package horde-%{V_horde_name}-kolab
%define         V_year  2007
%define         V_month 05
%define         V_day   24
%define		V_version %{V_year}%{V_month}%{V_day}
%define		V_date %{V_year}-%{V_month}-%{V_day}
%define         V_release 1

# Package Information
Name:		%{V_package}
Summary:	Turba is the Horde contact management application. 
URL:		http://www.horde.org/
Packager:	Gunnar Wrobel <wrobel at pardus.de> (p at rdus)
Version:	%{V_version}
Release:	%{V_release}
Class:		JUNK
License:	GPL
Group:		MAIL
Distribution:	OpenPKG

# List of Sources
Source0:	http://ftp.horde.org/pub/snaps/%{V_date}/%{V_horde_name}-HEAD-%{V_date}.tar.gz
Source1:        conf.php
Source2:        sources.php

##################################################
# PATCH COMMENT
#
#   Check if this can be integrated upstream
Patch0:         lib-Turba.php.patch

##################################################
# PATCH COMMENT
#
#   This is required until the Horde::Perms package
#   has been rewritten so that it does not use
#   the Horde::DataTree module anymore
Patch1:         config-sources.php.dist.patch
Patch2:         lib-Driver-ldap.php.patch

##################################################
# PATCH COMMENT
#
#   This can be omitted once Turba uses the generic
#   Share driver again.
#   See http://bugs.horde.org/ticket/?id=4960
Patch3:         lib-base.php.patch

# Build Info
Prefix:		%{l_prefix}
BuildRoot:	%{l_buildroot}
BuildPreReq:	apache, php, php::with_pear = yes
PreReq:		horde-kolab >= 20070131, apache, php, php::with_pear = yes
AutoReq:      no
AutoReqProv:  no
#BuildArch:    noarch

%description 
Turba is the Horde contact management application. It is a production
level address book, and makes heavy use of the Horde framework to
provide integration with IMP and other Horde applications.

Turba is a complete basic contact management application. SQL, LDAP,
IMSP, Kolab, and Horde Preferences backends are available and are well
tested. You can define the fields in your address books in a very
flexible way, just by changing the config files. You can import/export
from/to Pine, Mulberry, CSV, TSV, and vCard contacts. You can create
distribution lists from your addressbooks, which are handled
transparently by IMP and other Horde applications. You can share
address books with other users. And there are Horde API functions to
add and search for contacts.

%prep
	%setup -c -q

	cd %{V_horde_name}
	%patch -p0 -P 0
	%patch -p0 -P 1
	%patch -p0 -P 2
	%patch -p0 -P 3
	cd ..

%build

%install
	%{l_shtool} install -d $RPM_BUILD_ROOT%{l_prefix}/var/kolab/www/horde/%{V_horde_name}
	%{l_shtool} install -d $RPM_BUILD_ROOT%{l_prefix}/etc/kolab/templates

	cd %{V_horde_name}/config && for fl in *.dist;do cp $fl ${fl/.dist/};done; cd ../..

	cp -r %{V_horde_name} $RPM_BUILD_ROOT%{l_prefix}/var/kolab/www/horde/

	%{l_shtool} install -c -m 644 %{l_value -s -a} %{S:1} %{S:2} \
	  $RPM_BUILD_ROOT%{l_prefix}/var/kolab/www/horde/%{V_horde_name}/config/

	%{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}               \
	    '%config(noreplace) %{l_prefix}/var/kolab/www/horde/%{V_horde_name}/config/conf.php' \
	    '%config(noreplace) %{l_prefix}/var/kolab/www/horde/%{V_horde_name}/config/sources.php'

%clean
	rm -rf $RPM_BUILD_ROOT

%files -f files

--- NEW FILE: lib-Driver-ldap.php.patch ---
Index: lib/Driver/ldap.php
===================================================================
RCS file: /repository/turba/lib/Driver/ldap.php,v
retrieving revision 1.87
diff -u -B -r1.87 ldap.php
--- lib/Driver/ldap.php	4 Jan 2007 05:08:59 -0000	1.87
+++ lib/Driver/ldap.php	25 May 2007 11:02:09 -0000
@@ -54,6 +54,9 @@
         if (empty($params['deref'])) {
             $params['deref'] = LDAP_DEREF_NEVER;
         }
+        if (empty($params['read_only'])) {
+            $params['read_only'] = false;
+        }
 
         parent::Turba_Driver($params);
     }
@@ -749,4 +752,25 @@
         return $dn;
     }
 
+    /**
+     * Checks if the current user has the requested permission
+     * on this source.
+     *
+     * @param integer $perm  The permission to check for.
+     *
+     * @return boolean  true if user has permission, false otherwise.
+     */
+     function hasPermission($perm)
+    {
+        if ($this->usingShares || $this->_params['read_only'] === false) {
+            return parent::hasPermission($perm);
+        } else {
+            switch ($perm) {
+                case PERMS_EDIT: return false;
+                case PERMS_DELETE: return false;
+                default: return parent::hasPermission($perm);
+            }
+        }
+    }
+
 }

--- NEW FILE: lib-Turba.php.patch ---
Index: lib/Turba.php
===================================================================
RCS file: /repository/turba/lib/Turba.php,v
retrieving revision 1.121
diff -u -B -r1.121 Turba.php
--- lib/Turba.php	12 May 2007 14:58:12 -0000	1.121
+++ lib/Turba.php	25 May 2007 11:01:42 -0000
@@ -332,14 +332,13 @@
             } else {
                 $source = $in;
             }
-            $srcConfig = $GLOBALS['cfgSources'][$source];
             if (!$perms->exists('turba:sources:' . $in)) {
                 // Assume we have permissions if it's not explicitly
                 // set.  If this is a shared addressbook, the only
                 // perms we'd be checking are the extended
                 // permissions.
                 return true;
-            } elseif ((empty($srcConfig['use_shares'])) &&
+            } elseif ((empty($GLOBALS['cfgSources'][$source]['use_shares'])) &&
                       ($source === $in)) {
                 // Using Horde_Perms AND checking source level permsissions
                 return $perms->hasPermission('turba:sources:' . $in, $userID,

--- NEW FILE: lib-base.php.patch ---
Index: lib/base.php
===================================================================
RCS file: /repository/turba/lib/base.php,v
retrieving revision 1.84
diff -u -B -r1.84 base.php
--- lib/base.php	28 Feb 2007 19:16:12 -0000	1.84
+++ lib/base.php	25 May 2007 11:01:51 -0000
@@ -51,7 +51,12 @@
 // Turba_Share and Turba_VBook::
 require_once TURBA_BASE . '/lib/Share.php';
 require_once TURBA_BASE . '/lib/VBook.php';
-$GLOBALS['turba_shares'] = &Turba_Share::singleton();
+if (!empty($GLOBALS['conf']['kolab']['enabled'])) {
+    require_once 'Horde/Share.php';
+    $GLOBALS['turba_shares'] = &Horde_Share::singleton($registry->getApp());
+} else {
+    $GLOBALS['turba_shares'] = &Turba_Share::singleton();
+}
 
 // See if any of our sources are configured to use Turba_Share.
 $haveShare = false;
@@ -61,9 +66,6 @@
         $_SESSION['turba']['has_share'] = true;
     }
 }
-if (!empty($GLOBALS['conf']['kolab']['enabled'])) {
-    $haveShare = true;
-}
 if ($haveShare) {
     $GLOBALS['cfgSources'] = Turba::getConfigFromShares($cfgSources);
 } else {

--- NEW FILE: sources.php ---
<?php
/**
 * $Horde: turba/config/sources.php.dist,v 1.166 2007/05/23 22:08:54 wrobel Exp $
 *
 * This file is where you specify the sources of contacts available to users
 * at your installation. It contains a large number of EXAMPLES. Please
 * remove or comment out those examples that YOU DON'T NEED. There are a
 * number of properties that you can set for each server, including:
 *
 * title:       This is the common (user-visible) name that you want displayed
 *              in the contact source drop-down box.
 *
 * type:        The types 'ldap', 'sql', 'imsp' and 'prefs' are currently
 *              supported. Preferences-based address books are not intended
 *              for production installs unless you really know what you're
 *              doing - they are not searchable, and they won't scale well if
 *              a user has a large number of entries.
 *
 * params:      These are the connection parameters specific to the contact
 *              source. See below for examples of how to set these.
 *
 * Special params settings:
 *
 *   charset:       The character set that the backend stores data in. Many
 *                  LDAP servers use utf-8. Database servers typically use
 *                  iso-8859-1.
 *
 *   tls:           Only applies to LDAP servers. If true, then try to use a
 *                  TLS connection to the server.
 *
 *   scope:         Only applies to LDAP servers. Can be set to 'one' to
 *                  search one level of the LDAP directory, or 'sub' to search
 *                  all levels. 'one' will work for most setups and should be
 *                  much faster. However we default to 'sub' for backwards
 *                  compatibility.
 *
 *   checkrequired: Only applies to LDAP servers. If present, this value causes
 *                  the driver to consult the LDAP schema for any attributes
 *                  that are required by the given objectclass(es). Required
 *                  attributes will be provided automatically if the
 *                  'checkrequired_string' parameter is present.
 *                  *NOTE* You must have the Net_LDAP PEAR library installed
 *                  for this to work.
 *
 *   checksyntax:   Only applies to LDAP servers. If present, this value causes
 *                  the driver to inspect the LDAP schema for particular
 *                  attributes by the type defined in the corresponding schema
 *                  *NOTE* You must have the Net_LDAP PEAR library installed
 *                  for this to work.
 *
 *   deref:         Only applies to LDAP servers. If set, should be one of:
 *                    LDAP_DEREF_NEVER
 *                    LDAP_DEREF_SEARCHING
 *                    LDAP_DEREF_FINDING
 *                    LDAP_DEREF_ALWAYS
 *                  This tells the LDAP server when to dereference
 *                  aliases. See http://www.php.net/ldap for more
 *                  information.
 *
 *   dn:            Only applies to LDAP servers. Defines the list of LDAP
 *                  attributes that build a valid DN.
 *
 *   objectclass:   Only applies to LDAP servers. Defines a list of
 *                  objectclasses that the LDAP object must be a member of.
 *
 *   filter:        Filter helps to filter your result based on certain
 *                  condition in SQL and LDAP backends. A filter can be
 *                  specified to avoid some unwanted data. For example, if the
 *                  source is an external sql database, to select records with
 *                  the delete flag = 0:
 *                  'filter' = 'deleted=0'
 *
 * map:         This is a list of mappings from the Turba attribute names
 *              (on the left) to the attribute names by which they are known
 *              in this contact source (on the right). Turba also supports
 *              composite fields. A composite field is defined by mapping
 *              the field name to an array containing a list of component
 *              fields and a format string (similar to a printf() format
 *              string). 'attribute' defines where the composed value
 *              is saved, and can be left out. Here is an example:
 *              ...
 *              'name' => array('fields' => array('firstname', 'lastname'),
 *                              'format' => '%s %s',
 *                              'attribute' => 'object_name'),
 *              'firstname' => 'object_firstname',
 *              'lastname' => 'object_lastname',
 *              ...
 *
 *              Standard Turba attributes are:
 *                __key     : A backend-specific ID for the entry (any value
 *                            as long as it is unique inside that source;
 *                            required)
 *                __uid     : Globally unique ID of the entry (used for
 *                            synchronizing and must be able to be set to any
 *                            value)
 *                __owner   : User name of the contact's owner
 *                __type    : Either 'Object' or 'Group'
 *                __members : Serialized PHP array with list of Group members.
 *              More Turba attributes are defined in config/attributes.php.
 *
 * tabs:        All fields can be grouped into tabs with this optional entry.
 *              This list is multidimensional hash, the keys are the tab
 *              titles.
 *              Here is an example:
 *              'tabs' => array(
 *                  'Names' => array('firstname', 'lastname', 'alias'),
 *                  'Addresses' => array('homeAddress', 'workAddress')
 *              );
 *
 * search:      A list of Turba attribute names that can be searched for this
 *              source.
 *
 * strict:      A list of native field/attribute names that must always be
 *              matched exactly in a search.
 *
 * export:      If set to true, this source will appear on the Export menu,
 *              allowing users to export the contacts to a CSV (etc.) file.
 *
 * browse:      If set to true, this source will be browseable via the Browse
 *              menu item, and empty searches against the source will return
 *              all contacts.
 *
 * use_shares:  If this is present and true, Turba_Share functionality will
 *              be enabled for this source - allowing users to share their
 *              personal address books as well as to create new ones. Since
 *              Turba only supports having one backend configured for
 *              creating new shares, use the 'shares' configuration option to
 *              specify which backend will be used for creating new shares.
 *              All permission checking will be done against Turba_Share, but
 *              note that any 'extended' permissions (such as max_contacts)
 *              will still be enforced. Also note that the backend driver
 *              must have support for using this. Currently SQL and IMSP.
 *
 * Here are some example configurations:
 */

/* Begin Kolab sources. */
if (!empty($GLOBALS['conf']['kolab']['enabled'])) {

    require_once 'Horde/Kolab.php';

    if (!is_callable('Kolab', 'getServer')) {
        $server = $GLOBALS['conf']['kolab']['ldap']['server'];
    } else {
        $server = Kolab::getServer('ldap');
    }

    /* A global address book for a Kolab Server. This is typically a
     * read-only public directory, stored in the default Kolab LDAP server.
     * The user accessing this should have read permissions to the shared
     * directory in LDAP. */
    $cfgSources['kolab_global'] = array(
        'title' => _("Global Address Book"),
        'type' => 'ldap',
        'params' => array(
            'server' => $server,
            'port' => $GLOBALS['conf']['kolab']['ldap']['port'],
            'tls' => false,
            'root' => $GLOBALS['conf']['kolab']['ldap']['basedn'],
            'sizelimit' => 200,
            'dn' => array('cn'),
            'objectclass' => array(
                'inetOrgPerson'
            ),
            'scope' => 'one',
            'charset' => 'utf-8',
            'version' => 3,
            'bind_dn' => '',
            'bind_password' => '',
            'read_only' => true,
        ),
        'map' => array(
            '__key'             => 'dn',
            'name'              => 'cn',
            'firstname'         => 'givenName',
            'lastname'          => 'sn',
            'email'             => 'mail',
            'alias'             => 'alias',
            'title'             => 'title',
            'company'           => 'o',
            'workStreet'        => 'street',
            'workCity'          => 'l',
            'workProvince'      => 'st',
            'workPostalCode'    => 'postalCode',
            'workCountry'       => 'c',
            'homePhone'         => 'homePhone',
            'workPhone'         => 'telephoneNumber',
            'cellPhone'         => 'mobile',
            'fax'               => 'fax',
            'notes'             => 'description',
            'freebusyUrl'       => 'kolabHomeServer',
        ),
        'search' => array(
            'name',
            'firstname',
            'lastname',
            'email',
            'title',
            'company',
            'workAddress',
            'workCity',
            'workProvince',
            'workPostalCode',
            'workCountry',
            'homePhone',
            'workPhone',
            'cellPhone',
            'fax',
            'notes',
        ),
        'strict' => array(
            'dn',
        ),
        'export' => true,
        'browse' => true,
    );

    /**
     * The local address books for a Kolab user. These are stored in specially
     * flagged contact folder within the users Cyrus IMAP mailbox.
     */

    $cfgSources['kolab'] = array(
        'title' => _("Contacts"),
        'type' => 'kolab',
        'params' => array(
            'charset' => 'utf-8',
        ),
        'map' => array(
            '__key' => 'uid',
            'name'              => 'full-name',
            'firstname'         => 'given-name',
            'lastname'          => 'last-name',
            'title'             => 'job-title',
            'company'           => 'organization',
            'notes'             => 'body',
            'website'           => 'web-page',
            'nickname'          => 'nick-name',
            'email1'            => 'email1',
            'email2'            => 'email2',
            'email3'            => 'email3',
            'homePhone'         => 'phone-home1',
            'workPhone'         => 'phone-business1',
            'cellPhone'         => 'phone-mobile',
            'fax'               => 'phone-businessfax',
            'workStreet'        => 'addr-business-street',
            'workCity'          => 'addr-business-locality',
            'workProvince'      => 'addr-business-region',
            'workPostalCode'    => 'addr-business-postal-code',
            'workCountry'       => 'addr-business-country',
            'homeStreet'        => 'addr-home-street',
            'homeCity'          => 'addr-home-locality',
            'homeProvince'      => 'addr-home-region',
            'homePostalCode'    => 'addr-home-postal-code',
            'homeCountry'       => 'addr-home-country',
        ),
        'search' => array(
            'name',
            'firstname',
            'lastname',
            'email1',
            'email2',
            'email3',
            'title',
            'company',
            'notes',
            'homePhone',
            'workPhone',
            'cellPhone',
            'fax',
            'workStreet',
            'workCity',
            'workProvince',
            'workPostalCode',
            'workCountry',
            'homeStreet',
            'homeCity',
            'homeProvince',
            'homePostalCode',
            'homeCountry',
            'website',
            'nickname'
        ),
        'strict' => array(
            'uid',
        ),
        'export' => true,
        'browse' => true,
        'use_shares' => true,
        'shares_only' => true,
    );
}
/* End Kolab sources. */





More information about the commits mailing list