doc/kolab_wap-3.0.0.sql doc/sample-insert-group_types.php doc/sample-insert-options.php doc/sample-insert-user_types.php
Jeroen van Meeuwen
vanmeeuwen at kolabsys.com
Fri Apr 6 11:34:28 CEST 2012
doc/kolab_wap-3.0.0.sql | 91 ++++++++
doc/sample-insert-group_types.php | 102 +++++++++
doc/sample-insert-options.php | 43 ++++
doc/sample-insert-user_types.php | 395 ++++++++++++++++++++++++++++++++++++++
4 files changed, 631 insertions(+)
New commits:
commit 3ce1d5c270d3104756528e82df1bc9398771d4ff
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date: Fri Apr 6 11:33:31 2012 +0200
Add 3.0.0 initialization SQL file.
Add samples to insert custom group_types, options and user_types
diff --git a/doc/kolab_wap-3.0.0.sql b/doc/kolab_wap-3.0.0.sql
new file mode 100644
index 0000000..b94eb00
--- /dev/null
+++ b/doc/kolab_wap-3.0.0.sql
@@ -0,0 +1,91 @@
+-- phpMyAdmin SQL Dump
+-- version 3.4.8
+-- http://www.phpmyadmin.net
+--
+-- Host: localhost
+-- Generation Time: Mar 29, 2012 at 04:24 PM
+-- Server version: 5.5.13
+-- PHP Version: 5.3.8
+
+SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
+SET time_zone = "+00:00";
+
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+
+--
+-- Database: `kolab_wap`
+--
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `group_types`
+--
+
+CREATE TABLE IF NOT EXISTS `group_types` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `key` text NOT NULL,
+ `name` varchar(256) NOT NULL,
+ `description` text NOT NULL,
+ `attributes` longtext NOT NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `name` (`name`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
+
+--
+-- Dumping data for table `group_types`
+--
+
+INSERT INTO `group_types` (`id`, `key`, `name`, `description`, `attributes`) VALUES
+(1, 'kolab', 'Kolab Distribution Group', 'A Kolab Distribution Group (with mail address)', 's:187:"{"auto_form_fields":{"mail":{"data":["cn"]}},"fields":{"objectclass":["top","groupofuniquenames","kolabgroupofuniquenames"]},"form_fields":{"cn":[],"uniquemember":{"type":"multiselect"}}}";'),
+(2, 'posix', 'POSIX Group', 'A UNIX POSIX Group', 's:166:"{"auto_form_fields":{"gidnumber":[]},"fields":{"objectclass":["top","groupofuniquenames","posixgroup"]},"form_fields":{"cn":[],"uniquemember":{"type":"multiselect"}}}";');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `options`
+--
+
+CREATE TABLE IF NOT EXISTS `options` (
+ `attribute` varchar(128) NOT NULL,
+ `option_values` text NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+--
+-- Dumping data for table `options`
+--
+
+INSERT INTO `options` (`attribute`, `option_values`) VALUES
+('preferredlanguage', '["aa_DJ","aa_ER","aa_ET","af_ZA","am_ET","an_ES","ar_AE","ar_BH","ar_DZ","ar_EG","ar_IN","ar_IQ","ar_JO","ar_KW","ar_LB","ar_LY","ar_MA","ar_OM","ar_QA","ar_SA","ar_SD","ar_SY","ar_TN","ar_YE","as_IN","az_AZ","be_BY","bg_BG","bn_BD","bn_IN","bokmal","br_FR","bs_BA","byn_ER","C","ca_AD","ca_ES","ca_FR","ca_IT","catalan","croatian","csb_PL","cs_CZ","cy_GB","czech","da_DK","danish","dansk","de_AT","de_BE","de_CH","de_DE","de_LU","deutsch","dutch","dz_BT","eesti","el_CY","el_GR","en_AU","en_BW","en_CA","en_DK","en_GB","en_HK","en_IE","en_IN","en_NZ","en_PH","en_SG","en_US","en_ZA","en_ZW","es_AR","es_BO","es_CL","es_CO","es_CR","es_DO","es_EC","es_ES","es_GT","es_HN","es_MX","es_NI","es_PA","es_PE","es_PR","es_PY","es_SV","estonian","es_US","es_UY","es_VE","et_EE","eu_ES","fa_IR","fi_FI","finnish","fo_FO","fr_BE","fr_CA","fr_CH","french","fr_FR","fr_LU","fy_NL","ga_IE","galego","galician","gd_GB","german","gez_ER","gez_ET","gl_ES","greek","gu_IN","gv_GB","
hebrew","he_IL","hi_IN","hr_HR","hrvatski","hsb_DE","hu_HU","hungarian","hy_AM","icelandic","id_ID","is_IS","italian","it_CH","it_IT","iw_IL","ja_JP","japanese","ka_GE","kk_KZ","kl_GL","km_KH","kn_IN","ko_KR","korean","ku_TR","kw_GB","ky_KG","lg_UG","lithuanian","lo_LA","lt_LT","lv_LV","mai_IN","mg_MG","mi_NZ","mk_MK","ml_IN","mn_MN","mr_IN","ms_MY","mt_MT","nb_NO","ne_NP","nl_BE","nl_NL","nn_NO","no_NO","norwegian","nr_ZA","nso_ZA","nynorsk","oc_FR","om_ET","om_KE","or_IN","pa_IN","pa_PK","pl_PL","polish","portuguese","POSIX","pt_BR","pt_PT","romanian","ro_RO","ru_RU","russian","ru_UA","rw_RW","se_NO","sid_ET","si_LK","sk_SK","slovak","slovene","slovenian","sl_SI","so_DJ","so_ET","so_KE","so_SO","spanish","sq_AL","sr_CS","sr_ME","sr_RS","ss_ZA","st_ZA","sv_FI","sv_SE","swedish","ta_IN","te_IN","tg_TJ","thai","th_TH","ti_ER","ti_ET","tig_ER","tl_PH","tn_ZA","tr_CY","tr_TR","ts_ZA","tt_RU","turkish","uk_UA","ur_PK","uz_UZ","ve_ZA","vi_VN","wa_BE","xh_ZA","yi_US","zh_CN","zh_H
K","zh_SG","zh_TW","zu_ZA"]');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `user_types`
+--
+
+CREATE TABLE IF NOT EXISTS `user_types` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `key` text NOT NULL,
+ `name` varchar(256) NOT NULL,
+ `description` text NOT NULL,
+ `attributes` longtext NOT NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `name` (`name`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
+
+--
+-- Dumping data for table `user_types`
+--
+
+INSERT INTO `user_types` (`id`, `key`, `name`, `description`, `attributes`) VALUES
+(1, 'kolab', 'Kolab User', 'A Kolab User', '{"auto_form_fields":{"cn":{"data":["givenname","sn"]},"displayname":{"data":["givenname","sn"]},"mail":{"data":["givenname","preferredlanguage","sn"]},"mailalternateaddress":{"data":["givenname","preferredlanguage","sn"]},"mailhost":[],"uid":{"data":["givenname","preferredlanguage","sn"]},"userpassword":[]},"form_fields":{"initials":[],"givenname":[],"mailalternateaddress":{"type":"list"},"nsrole":{"type":"list","autocomplete":true},"preferredlanguage":{"type":"select","values":["en_US","de_DE","de_CH","en_GB","fr_FR"]},"sn":[],"title":[]},"fields":{"objectclass":["top","inetorgperson","organizationalperson","person","kolabinetorgperson"]}}'),
+(2, 'posix', 'POSIX User', 'A POSIX user (with a home directory and shell access)', '{"auto_form_fields":{"cn":{"data":["givenname","sn"]},"displayname":{"data":["givenname","sn"]},"gidnumber":[],"homedirectory":{"data":["givenname","sn"]},"uid":{"data":["givenname","sn"]},"uidnumber":[],"userpassword":[]},"form_fields":{"givenname":[],"initials":[],"preferredlanguage":{"type":"select","values_source":"<uri>"},"shell":{"type":"select","values":["/bin/bash","/usr/bin/git-shell","/sbin/nologin"]},"sn":[],"title":[]},"fields":{"objectclass":["top","inetorgperson","organizationalperson","person","posixaccount"]}}');
+
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
diff --git a/doc/sample-insert-group_types.php b/doc/sample-insert-group_types.php
new file mode 100644
index 0000000..c9d38f6
--- /dev/null
+++ b/doc/sample-insert-group_types.php
@@ -0,0 +1,102 @@
+#!/usr/bin/php
+<?php
+
+ if (isset($_SERVER["REQUEST_METHOD"]) && !empty($SERVER["REQUEST_METHOD"])) {
+ die("Not intended for execution through the webserver, sorry!");
+ }
+
+ require_once("lib/functions.php");
+
+ $db = SQL::get_instance();
+
+ $result = $db->query("TRUNCATE `group_types`");
+
+ $attributes = Array(
+ "auto_form_fields" => Array(
+ "mail" => Array(
+ "data" => Array(
+ "cn",
+ ),
+ ),
+ ),
+ "fields" => Array(
+ "objectclass" => Array(
+ "top",
+ "groupofuniquenames",
+ "kolabgroupofuniquenames",
+ ),
+ ),
+ "form_fields" => Array(
+ "cn" => Array(),
+ "uniquemember" => Array(
+ "type" => "list",
+ "autocomplete" => true,
+ "optional" => true,
+ ),
+ ),
+ );
+
+ $result = $db->query("INSERT INTO `group_types` (`key`, `name`, `description`, `attributes`) " .
+ "VALUES ('kolab','Kolab Distribution Group', 'A Kolab Distribution Group (with mail address)'," .
+ "'" . json_encode($attributes) . "')");
+
+ $attributes = Array(
+ "auto_form_fields" => Array(
+ "gidnumber" => Array(),
+ ),
+ "fields" => Array(
+ "objectclass" => Array(
+ "top",
+ "groupofuniquenames",
+ "posixgroup",
+ ),
+ ),
+ "form_fields" => Array(
+ "cn" => Array(),
+ "uniquemember" => Array(
+ "type" => "list",
+ "autocomplete" => true,
+ "optional" => true,
+ ),
+ ),
+ );
+
+ $result = $db->query("INSERT INTO `group_types` (`key`, `name`, `description`, `attributes`) " .
+ "VALUES ('posix','(Pure) POSIX Group', 'A pure UNIX POSIX Group'," .
+ "'" . json_encode($attributes) . "')");
+
+ $attributes = Array(
+ "auto_form_fields" => Array(
+ "gidnumber" => Array(),
+ "mail" => Array(
+ "data" => Array(
+ "cn",
+ ),
+ ),
+ ),
+ "fields" => Array(
+ "objectclass" => Array(
+ "top",
+ "groupofuniquenames",
+ "kolabgroupofuniquenames",
+ "posixgroup",
+ ),
+ ),
+ "form_fields" => Array(
+ "cn" => Array(),
+ "mail" => Array(
+ "optional" => true
+ ),
+ "uniquemember" => Array(
+ "type" => "list",
+ "autocomplete" => true,
+ "optional" => true,
+ ),
+ ),
+ );
+
+ $result = $db->query("INSERT INTO `group_types` (`key`, `name`, `description`, `attributes`) " .
+ "VALUES ('posix_mail','Mail-enabled POSIX Group', 'A Kolab and also UNIX POSIX Group'," .
+ "'" . json_encode($attributes) . "')");
+
+?>
diff --git a/doc/sample-insert-options.php b/doc/sample-insert-options.php
new file mode 100644
index 0000000..3e87849
--- /dev/null
+++ b/doc/sample-insert-options.php
@@ -0,0 +1,43 @@
+#!/usr/bin/php
+<?php
+ if (isset($_SERVER["REQUEST_METHOD"]) || !empty($_SERVER["REQUEST_METHOD"])) {
+ die("Not for execution through webserver");
+ }
+
+ require_once('lib/functions.php');
+
+ $db = SQL::get_instance();
+
+ $db->query("TRUNCATE `options`");
+
+ exec("locale -a | cut -d'.' -f 1 | cut -d'@' -f1 | grep -E \"^([a-zA-Z_]*)\$\" | sort -u", $output);
+
+// var_dump($output);
+
+ $json = json_encode($output);
+
+// var_dump($json);
+
+ unset($output);
+
+ $result = $db->query('INSERT INTO `options` (`attribute`, `option_values`) VALUES ('.
+ '\'preferredlanguage\', \'' . $json . '\')');
+
+ var_dump($result);
+/*
+ exec('cat ./iso3166-countrycodes.txt | sed -r -e \'s/(.*)\s+([A-Z]{2})\s+([A-Z]{3})\s+([0-9]{3})\s*$/\2/g\' -e \'/^[A-Z]{2}$/!d\'', $output);
+
+ var_dump($output);
+
+ sort($output);
+
+ $json = json_encode($output);
+
+// var_dump($json);
+
+ $result = $db->query('INSERT INTO `options` (`attribute`, `option_values`) VALUES ('.
+ '\'c\', \'' . $json . '\')');
+
+ var_dump($result);
+*/
+?>
diff --git a/doc/sample-insert-user_types.php b/doc/sample-insert-user_types.php
new file mode 100644
index 0000000..7470aec
--- /dev/null
+++ b/doc/sample-insert-user_types.php
@@ -0,0 +1,395 @@
+#!/usr/bin/php
+<?php
+
+ if (isset($_SERVER["REQUEST_METHOD"]) && !empty($SERVER["REQUEST_METHOD"])) {
+ die("Not intended for execution through the webserver, sorry!");
+ }
+
+ require_once("lib/functions.php");
+
+ $db = SQL::get_instance();
+
+ $result = $db->query("TRUNCATE `user_types`");
+
+ $attributes = Array(
+ "auto_form_fields" => Array(
+ "cn" => Array(
+ "data" => Array(
+ "givenname",
+ "sn",
+ ),
+ ),
+ "displayname" => Array(
+ "data" => Array(
+ "givenname",
+ "sn",
+ ),
+ ),
+ "mail" => Array(
+ "data" => Array(
+ "givenname",
+ "preferredlanguage",
+ "sn",
+ ),
+ ),
+ "mailalternateaddress" => Array(
+ "data" => Array(
+ "givenname",
+ "preferredlanguage",
+ "sn",
+ ),
+ "optional" => true,
+ ),
+ "mailhost" => Array(
+ "optional" => true,
+ ),
+ "uid" => Array(
+ "data" => Array(
+ "givenname",
+ "preferredlanguage",
+ "sn",
+ ),
+ ),
+ "userpassword" => Array(
+ "optional" => true,
+ ),
+ ),
+ "form_fields" => Array(
+/*
+ "c" => Array(
+ "type" => "select",
+ "optional" => true,
+ ),
+*/
+ "givenname" => Array(),
+ "initials" => Array(
+ "optional" => true,
+ ),
+ "kolabdelegate" => Array(
+ "type" => "list",
+ "autocomplete" => true,
+ "optional" => true,
+ ),
+ "kolabinvitationpolicy" => Array(
+ "type" => "select",
+ "values" => Array(
+ "",
+ "ACT_MANUAL",
+ "ACT_REJECT",
+ ),
+ "optional" => true,
+ ),
+ "kolaballowsmtprecipient" => Array(
+ "type" => "list",
+ "optional" => true,
+ ),
+ "kolaballowsmtpsender" => Array(
+ "type" => "list",
+ "optional" => true,
+ ),
+ "l" => Array(
+ "optional" => true,
+ ),
+ "mailalternateaddress" => Array(
+ "type" => "list",
+ "optional" => true,
+ ),
+ "mailquota" => Array(
+ "optional" => true,
+ ),
+ "mobile" => Array(
+ "optional" => true,
+ ),
+ "nsroledn" => Array(
+ "type" => "list",
+ "autocomplete" => true,
+ "optional" => true
+ ),
+ "o" => Array(
+ "optional" => true,
+ ),
+ "ou" => Array(
+ "type" => "select",
+ ),
+ "pager" => Array(
+ "optional" => true,
+ ),
+ "postalcode" => Array(
+ "optional" => true,
+ ),
+ "preferredlanguage" => Array(
+ "type" => "select",
+ ),
+ "sn" => Array(),
+ "street" => Array(
+ "optional" => true,
+ ),
+ "telephonenumber" => Array(
+ "optional" => true,
+ ),
+ "title" => Array(
+ "optional" => true,
+ ),
+ "userpassword" => Array(
+ "optional" => true,
+ ),
+ ),
+ "fields" => Array(
+ "objectclass" => Array(
+ "top",
+ "inetorgperson",
+ "kolabinetorgperson",
+ "mailrecipient",
+ "organizationalperson",
+ "person",
+ ),
+ ),
+ );
+
+ $result = $db->query("INSERT INTO `user_types` (`key`, `name`, `description`, `attributes`) " .
+ "VALUES ('kolab','Kolab User', 'A Kolab User'," .
+ "'" . json_encode($attributes) . "')");
+
+ $attributes = Array(
+ "auto_form_fields" => Array(
+ "cn" => Array(
+ "data" => Array(
+ "givenname",
+ "sn",
+ ),
+ ),
+ "displayname" => Array(
+ "data" => Array(
+ "givenname",
+ "sn",
+ ),
+ ),
+ "gidnumber" => Array(),
+ "homedirectory" => Array(
+ "data" => Array(
+ "givenname",
+ "sn",
+ ),
+ ),
+ "uid" => Array(
+ "data" => Array(
+ "givenname",
+ "sn",
+ ),
+ ),
+ "uidnumber" => Array(),
+ "userpassword" => Array(
+ "optional" => true,
+ ),
+ ),
+ "form_fields" => Array(
+ "givenname" => Array(),
+ "initials" => Array(
+ "optional" => true,
+ ),
+ "preferredlanguage" => Array(
+ "type" => "select",
+ "values" => Array(
+ "en_US",
+ "de_DE",
+ "de_CH",
+ "en_GB",
+ "fi_FI",
+ "fr_FR",
+ "hu_HU",
+ ),
+ ),
+ "loginshell" => Array(
+ "type" => "select",
+ "values" => Array(
+ "/bin/bash",
+ "/usr/bin/git-shell",
+ "/sbin/nologin",
+ ),
+ ),
+ "ou" => Array(
+ "type" => "select",
+ ),
+ "sn" => Array(),
+ "title" => Array(
+ "optional" => true,
+ ),
+ "userpassword" => Array(
+ "optional" => true,
+ ),
+ ),
+ "fields" => Array(
+ "objectclass" => Array(
+ "top",
+ "inetorgperson",
+ "organizationalperson",
+ "person",
+ "posixaccount",
+ ),
+ ),
+ );
+
+ $result = $db->query("INSERT INTO `user_types` (`key`, `name`, `description`, `attributes`) " .
+ "VALUES ('posix','POSIX User', 'A POSIX user (with a home directory and shell access)'," .
+ "'" . json_encode($attributes) . "')");
+
+ $attributes = Array(
+ "auto_form_fields" => Array(
+ "cn" => Array(
+ "data" => Array(
+ "givenname",
+ "preferredlanguage",
+ "sn",
+ ),
+ ),
+ "displayname" => Array(
+ "data" => Array(
+ "givenname",
+ "preferredlanguage",
+ "sn",
+ ),
+ ),
+ "gidnumber" => Array(),
+ "homedirectory" => Array(
+ "data" => Array(
+ "givenname",
+ "preferredlanguage",
+ "sn",
+ ),
+ ),
+ "mail" => Array(
+ "data" => Array(
+ "givenname",
+ "preferredlanguage",
+ "sn",
+ ),
+ ),
+ "mailalternateaddress" => Array(
+ "data" => Array(
+ "givenname",
+ "preferredlanguage",
+ "sn",
+ ),
+ "optional" => true,
+ ),
+ "mailhost" => Array(
+ "optional" => true,
+ ),
+ "uid" => Array(
+ "data" => Array(
+ "givenname",
+ "preferredlanguage",
+ "sn",
+ ),
+ ),
+ "uidnumber" => Array(),
+ "userpassword" => Array(
+ "optional" => true,
+ ),
+ ),
+ "form_fields" => Array(
+/*
+ "c" => Array(
+ "type" => "select",
+ "optional" => true,
+ ),
+*/
+ "givenname" => Array(),
+ "initials" => Array(
+ "optional" => true,
+ ),
+ "kolabdelegate" => Array(
+ "type" => "list",
+ "autocomplete" => true,
+ "optional" => true,
+ ),
+ "kolabinvitationpolicy" => Array(
+ "type" => "select",
+ "values" => Array(
+ "",
+ "ACT_MANUAL",
+ "ACT_REJECT",
+ ),
+ "optional" => true,
+ ),
+ "kolaballowsmtprecipient" => Array(
+ "type" => "list",
+ "optional" => true,
+ ),
+ "kolaballowsmtpsender" => Array(
+ "type" => "list",
+ "optional" => true,
+ ),
+ "l" => Array(
+ "optional" => true,
+ ),
+ "loginshell" => Array(
+ "type" => "select",
+ "values" => Array(
+ "/bin/bash",
+ "/usr/bin/git-shell",
+ "/sbin/nologin",
+ ),
+ ),
+ "mailalternateaddress" => Array(
+ "type" => "list",
+ "optional" => true,
+ ),
+ "mailquota" => Array(
+ "optional" => true,
+ ),
+ "mobile" => Array(
+ "optional" => true,
+ ),
+ "nsroledn" => Array(
+ "type" => "list",
+ "autocomplete" => true,
+ "optional" => true,
+ ),
+ "o" => Array(
+ "optional" => true,
+ ),
+ "ou" => Array(
+ "type" => "select",
+ ),
+ "pager" => Array(
+ "optional" => true,
+ ),
+ "postalcode" => Array(
+ "optional" => true,
+ ),
+ "preferredlanguage" => Array(
+ "type" => "select",
+ ),
+ "sn" => Array(),
+ "street" => Array(
+ "optional" => true,
+ ),
+ "telephonenumber" => Array(
+ "optional" => true,
+ ),
+ "title" => Array(
+ "optional" => true,
+ ),
+ "userpassword" => Array(
+ "optional" => true,
+ ),
+ ),
+ "fields" => Array(
+ "objectclass" => Array(
+ "top",
+ "inetorgperson",
+ "kolabinetorgperson",
+ "mailrecipient",
+ "organizationalperson",
+ "person",
+ "posixaccount",
+ ),
+ ),
+ );
+
+ $result = $db->query("INSERT INTO `user_types` (`key`, `name`, `description`, `attributes`) " .
+ "VALUES ('kolab_posix','Mail-enabled POSIX User', 'A mail-enabled POSIX User'," .
+ "'" . json_encode($attributes) . "')");
+
+?>
More information about the commits
mailing list