summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak <machniak@kolabsys.com>2014-08-26 09:09:40 (GMT)
committerAleksander Machniak <machniak@kolabsys.com>2014-08-26 09:09:40 (GMT)
commita21a3ede4bfc20c2b1d14d5aa6656df1c3fd46aa (patch)
treeea8bfab5c6da0de02df88e0775a6a2faad453f4d
parent7fd434797e24e256bfec7645048767ef9c4d3afe (diff)
downloadkolab-wap-a21a3ede4bfc20c2b1d14d5aa6656df1c3fd46aa.tar.gz
Make possible to define default object type (#2587)
-rw-r--r--doc/kolab_wap.sql18
-rw-r--r--doc/sample-insert-user_types.php6
-rw-r--r--lib/api/kolab_api_service_type.php12
-rw-r--r--lib/client/kolab_client_task_settings.php13
-rw-r--r--lib/kolab_client_task.php12
-rw-r--r--lib/locale/en_US.php1
-rw-r--r--public_html/js/kolab_admin.js1
7 files changed, 46 insertions, 17 deletions
diff --git a/doc/kolab_wap.sql b/doc/kolab_wap.sql
index d8e7c72..18a4b03 100644
--- a/doc/kolab_wap.sql
+++ b/doc/kolab_wap.sql
@@ -28,6 +28,7 @@ CREATE TABLE `group_types` (
`name` varchar(256) NOT NULL,
`description` text NOT NULL,
`attributes` longtext NOT NULL,
+ `is_default` tinyint(1) DEFAULT 0,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1;
@@ -39,7 +40,7 @@ CREATE TABLE `group_types` (
LOCK TABLES `group_types` WRITE;
/*!40000 ALTER TABLE `group_types` DISABLE KEYS */;
-INSERT INTO `group_types` VALUES (1,'kolab','Kolab Distribution Group (Static)','A static Kolab Distribution Group (with mail address)','{\"auto_form_fields\":{\"mail\":{\"data\":[\"cn\"]}},\"fields\":{\"objectclass\":[\"top\",\"groupofuniquenames\",\"kolabgroupofuniquenames\"]},\"form_fields\":{\"cn\":[],\"kolaballowsmtprecipient\":{\"type\":\"list\",\"optional\":true},\"kolaballowsmtpsender\":{\"type\":\"list\",\"optional\":true},\"ou\":{\"type\":\"select\"},\"uniquemember\":{\"type\":\"list\",\"autocomplete\":true,\"optional\":true}}}'),(2,'kolab_dynamic','Kolab Distribution Group (Dynamic)','A dynamic Kolab Distribution Group (with mail address)','{\"auto_form_fields\":{\"mail\":{\"data\":[\"cn\"]}},\"fields\":{\"objectclass\":[\"top\",\"groupofurls\",\"kolabgroupofuniquenames\"]},\"form_fields\":{\"cn\":[],\"kolaballowsmtprecipient\":{\"type\":\"list\",\"optional\":true},\"kolaballowsmtpsender\":{\"type\":\"list\",\"optional\":true},\"memberurl\":{\"type\":\"ldap_url\",\"optional\":true},\"ou\":{\"type\":\"select\"},\"uniquemember\":{\"type\":\"list\",\"autocomplete\":true,\"optional\":true}}}'),(3,'posix','(Pure) POSIX Group','A pure UNIX POSIX Group','{\"auto_form_fields\":{\"gidnumber\":[]},\"fields\":{\"objectclass\":[\"top\",\"groupofuniquenames\",\"posixgroup\"]},\"form_fields\":{\"cn\":[],\"ou\":{\"type\":\"select\"},\"uniquemember\":{\"type\":\"list\",\"autocomplete\":true,\"optional\":true}}}'),(4,'posix_mail','Mail-enabled POSIX Group','A Kolab and also UNIX POSIX Group','{\"auto_form_fields\":{\"gidnumber\":[],\"mail\":{\"data\":[\"cn\"]}},\"fields\":{\"objectclass\":[\"top\",\"groupofuniquenames\",\"kolabgroupofuniquenames\",\"posixgroup\"]},\"form_fields\":{\"cn\":[],\"kolaballowsmtprecipient\":{\"type\":\"list\",\"optional\":true},\"kolaballowsmtpsender\":{\"type\":\"list\",\"optional\":true},\"mail\":{\"optional\":true},\"ou\":{\"type\":\"select\"},\"uniquemember\":{\"type\":\"list\",\"autocomplete\":true,\"optional\":true}}}'),(5,'simple','Simple Group (Static)','A simple, traditional LDAP group with a static list of members','{\"auto_form_fields\":[],\"fields\":{\"objectclass\":[\"top\",\"groupofuniquenames\"]},\"form_fields\":{\"cn\":[],\"ou\":{\"type\":\"select\"},\"uniquemember\":{\"type\":\"list\",\"autocomplete\":true,\"optional\":true}}}');
+INSERT INTO `group_types` VALUES (1,'kolab','Kolab Distribution Group (Static)','A static Kolab Distribution Group (with mail address)','{\"auto_form_fields\":{\"mail\":{\"data\":[\"cn\"]}},\"fields\":{\"objectclass\":[\"top\",\"groupofuniquenames\",\"kolabgroupofuniquenames\"]},\"form_fields\":{\"cn\":[],\"kolaballowsmtprecipient\":{\"type\":\"list\",\"optional\":true},\"kolaballowsmtpsender\":{\"type\":\"list\",\"optional\":true},\"ou\":{\"type\":\"select\"},\"uniquemember\":{\"type\":\"list\",\"autocomplete\":true,\"optional\":true}}}',0),(2,'kolab_dynamic','Kolab Distribution Group (Dynamic)','A dynamic Kolab Distribution Group (with mail address)','{\"auto_form_fields\":{\"mail\":{\"data\":[\"cn\"]}},\"fields\":{\"objectclass\":[\"top\",\"groupofurls\",\"kolabgroupofuniquenames\"]},\"form_fields\":{\"cn\":[],\"kolaballowsmtprecipient\":{\"type\":\"list\",\"optional\":true},\"kolaballowsmtpsender\":{\"type\":\"list\",\"optional\":true},\"memberurl\":{\"type\":\"ldap_url\",\"optional\":true},\"ou\":{\"type\":\"select\"},\"uniquemember\":{\"type\":\"list\",\"autocomplete\":true,\"optional\":true}}}',0),(3,'posix','(Pure) POSIX Group','A pure UNIX POSIX Group','{\"auto_form_fields\":{\"gidnumber\":[]},\"fields\":{\"objectclass\":[\"top\",\"groupofuniquenames\",\"posixgroup\"]},\"form_fields\":{\"cn\":[],\"ou\":{\"type\":\"select\"},\"uniquemember\":{\"type\":\"list\",\"autocomplete\":true,\"optional\":true}}}',0),(4,'posix_mail','Mail-enabled POSIX Group','A Kolab and also UNIX POSIX Group','{\"auto_form_fields\":{\"gidnumber\":[],\"mail\":{\"data\":[\"cn\"]}},\"fields\":{\"objectclass\":[\"top\",\"groupofuniquenames\",\"kolabgroupofuniquenames\",\"posixgroup\"]},\"form_fields\":{\"cn\":[],\"kolaballowsmtprecipient\":{\"type\":\"list\",\"optional\":true},\"kolaballowsmtpsender\":{\"type\":\"list\",\"optional\":true},\"mail\":{\"optional\":true},\"ou\":{\"type\":\"select\"},\"uniquemember\":{\"type\":\"list\",\"autocomplete\":true,\"optional\":true}}}',0),(5,'simple','Simple Group (Static)','A simple, traditional LDAP group with a static list of members','{\"auto_form_fields\":[],\"fields\":{\"objectclass\":[\"top\",\"groupofuniquenames\"]},\"form_fields\":{\"cn\":[],\"ou\":{\"type\":\"select\"},\"uniquemember\":{\"type\":\"list\",\"autocomplete\":true,\"optional\":true}}}',0);
/*!40000 ALTER TABLE `group_types` ENABLE KEYS */;
UNLOCK TABLES;
@@ -79,6 +80,7 @@ CREATE TABLE `ou_types` (
`name` varchar(256) NOT NULL,
`description` text NOT NULL,
`attributes` longtext NOT NULL,
+ `is_default` tinyint(1) DEFAULT 0,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
@@ -90,7 +92,7 @@ CREATE TABLE `ou_types` (
LOCK TABLES `ou_types` WRITE;
/*!40000 ALTER TABLE `ou_types` DISABLE KEYS */;
-INSERT INTO `ou_types` VALUES (1,'unit','Standard Organizational Unit','A standard organizational unit definition','{\"auto_form_fields\":[],\"fields\":{\"objectclass\":[\"top\",\"organizationalunit\"]},\"form_fields\":{\"ou\":[],\"description\":[],\"aci\":{\"optional\":true,\"type\":\"aci\"}}}');
+INSERT INTO `ou_types` VALUES (1,'unit','Standard Organizational Unit','A standard organizational unit definition','{\"auto_form_fields\":[],\"fields\":{\"objectclass\":[\"top\",\"organizationalunit\"]},\"form_fields\":{\"ou\":[],\"description\":[],\"aci\":{\"optional\":true,\"type\":\"aci\"}}}',0);
/*!40000 ALTER TABLE `ou_types` ENABLE KEYS */;
UNLOCK TABLES;
@@ -107,6 +109,7 @@ CREATE TABLE `resource_types` (
`name` varchar(256) NOT NULL,
`description` text NOT NULL,
`attributes` longtext NOT NULL,
+ `is_default` tinyint(1) DEFAULT 0,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1;
@@ -118,7 +121,7 @@ CREATE TABLE `resource_types` (
LOCK TABLES `resource_types` WRITE;
/*!40000 ALTER TABLE `resource_types` DISABLE KEYS */;
-INSERT INTO `resource_types` VALUES (1,'collection','Resource Collection','A collection or pool of resources','{\"auto_form_fields\":{\"mail\":{\"data\":[\"cn\"]}},\"fields\":{\"objectclass\":[\"top\",\"groupofuniquenames\",\"kolabgroupofuniquenames\"]},\"form_fields\":{\"cn\":[],\"ou\":{\"type\":\"select\"},\"uniquemember\":{\"type\":\"list\",\"autocomplete\":true,\"optional\":true}}}'),(2,'car','Car','A car','{\"auto_form_fields\":{\"cn\":{\"data\":[\"cn\"]},\"kolabtargetfolder\":{\"data\":[\"cn\"]},\"mail\":{\"data\":[\"cn\"]}},\"fields\":{\"objectclass\":[\"top\",\"kolabsharedfolder\",\"mailrecipient\"],\"kolabfoldertype\":[\"event\"]},\"form_fields\":{\"acl\":{\"type\":\"imap_acl\",\"optional\":true},\"cn\":[],\"ou\":{\"type\":\"select\"},\"owner\":{\"type\":\"list\",\"autocomplete\":true,\"optional\":true}}}'),(3,'confroom','Conference Room','A conference room','{\"auto_form_fields\":{\"cn\":{\"data\":[\"cn\"]},\"kolabtargetfolder\":{\"data\":[\"cn\"]},\"mail\":{\"data\":[\"cn\"]}},\"fields\":{\"objectclass\":[\"top\",\"kolabsharedfolder\",\"mailrecipient\"],\"kolabfoldertype\":[\"event\"]},\"form_fields\":{\"acl\":{\"type\":\"imap_acl\",\"optional\":true},\"cn\":[],\"ou\":{\"type\":\"select\"},\"owner\":{\"type\":\"list\",\"autocomplete\":true,\"optional\":true}}}'),(4,'projector','Projector','A portable overhead projector','{\"auto_form_fields\":{\"cn\":{\"data\":[\"cn\"]},\"kolabtargetfolder\":{\"data\":[\"cn\"]},\"mail\":{\"data\":[\"cn\"]}},\"fields\":{\"objectclass\":[\"top\",\"kolabsharedfolder\",\"mailrecipient\"],\"kolabfoldertype\":[\"event\"]},\"form_fields\":{\"acl\":{\"type\":\"imap_acl\",\"optional\":true},\"cn\":[],\"ou\":{\"type\":\"select\"},\"owner\":{\"type\":\"list\",\"autocomplete\":true,\"optional\":true}}}'),(5,'footballtickets','Football Season Tickets','Season tickets to the game (pretty good seats too!)','{\"auto_form_fields\":{\"cn\":{\"data\":[\"cn\"]},\"kolabtargetfolder\":{\"data\":[\"cn\"]},\"mail\":{\"data\":[\"cn\"]}},\"fields\":{\"objectclass\":[\"top\",\"kolabsharedfolder\",\"mailrecipient\"],\"kolabfoldertype\":[\"event\"]},\"form_fields\":{\"acl\":{\"type\":\"imap_acl\",\"optional\":true},\"cn\":[],\"ou\":{\"type\":\"select\"},\"owner\":{\"type\":\"list\",\"autocomplete\":true,\"optional\":true}}}');
+INSERT INTO `resource_types` VALUES (1,'collection','Resource Collection','A collection or pool of resources','{\"auto_form_fields\":{\"mail\":{\"data\":[\"cn\"]}},\"fields\":{\"objectclass\":[\"top\",\"groupofuniquenames\",\"kolabgroupofuniquenames\"]},\"form_fields\":{\"cn\":[],\"ou\":{\"type\":\"select\"},\"uniquemember\":{\"type\":\"list\",\"autocomplete\":true,\"optional\":true}}}',0),(2,'car','Car','A car','{\"auto_form_fields\":{\"cn\":{\"data\":[\"cn\"]},\"kolabtargetfolder\":{\"data\":[\"cn\"]},\"mail\":{\"data\":[\"cn\"]}},\"fields\":{\"objectclass\":[\"top\",\"kolabsharedfolder\",\"mailrecipient\"],\"kolabfoldertype\":[\"event\"]},\"form_fields\":{\"acl\":{\"type\":\"imap_acl\",\"optional\":true},\"cn\":[],\"ou\":{\"type\":\"select\"},\"owner\":{\"type\":\"list\",\"autocomplete\":true,\"optional\":true}}}',0),(3,'confroom','Conference Room','A conference room','{\"auto_form_fields\":{\"cn\":{\"data\":[\"cn\"]},\"kolabtargetfolder\":{\"data\":[\"cn\"]},\"mail\":{\"data\":[\"cn\"]}},\"fields\":{\"objectclass\":[\"top\",\"kolabsharedfolder\",\"mailrecipient\"],\"kolabfoldertype\":[\"event\"]},\"form_fields\":{\"acl\":{\"type\":\"imap_acl\",\"optional\":true},\"cn\":[],\"ou\":{\"type\":\"select\"},\"owner\":{\"type\":\"list\",\"autocomplete\":true,\"optional\":true}}}',0),(4,'projector','Projector','A portable overhead projector','{\"auto_form_fields\":{\"cn\":{\"data\":[\"cn\"]},\"kolabtargetfolder\":{\"data\":[\"cn\"]},\"mail\":{\"data\":[\"cn\"]}},\"fields\":{\"objectclass\":[\"top\",\"kolabsharedfolder\",\"mailrecipient\"],\"kolabfoldertype\":[\"event\"]},\"form_fields\":{\"acl\":{\"type\":\"imap_acl\",\"optional\":true},\"cn\":[],\"ou\":{\"type\":\"select\"},\"owner\":{\"type\":\"list\",\"autocomplete\":true,\"optional\":true}}}',0),(5,'footballtickets','Football Season Tickets','Season tickets to the game (pretty good seats too!)','{\"auto_form_fields\":{\"cn\":{\"data\":[\"cn\"]},\"kolabtargetfolder\":{\"data\":[\"cn\"]},\"mail\":{\"data\":[\"cn\"]}},\"fields\":{\"objectclass\":[\"top\",\"kolabsharedfolder\",\"mailrecipient\"],\"kolabfoldertype\":[\"event\"]},\"form_fields\":{\"acl\":{\"type\":\"imap_acl\",\"optional\":true},\"cn\":[],\"ou\":{\"type\":\"select\"},\"owner\":{\"type\":\"list\",\"autocomplete\":true,\"optional\":true}}}',0);
/*!40000 ALTER TABLE `resource_types` ENABLE KEYS */;
UNLOCK TABLES;
@@ -135,6 +138,7 @@ CREATE TABLE `role_types` (
`name` varchar(256) NOT NULL,
`description` text NOT NULL,
`attributes` longtext NOT NULL,
+ `is_default` tinyint(1) DEFAULT 0,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
@@ -146,7 +150,7 @@ CREATE TABLE `role_types` (
LOCK TABLES `role_types` WRITE;
/*!40000 ALTER TABLE `role_types` DISABLE KEYS */;
-INSERT INTO `role_types` VALUES (1,'simple_managed','Standard Role','A standard role definition','{\"auto_form_fields\":[],\"fields\":{\"objectclass\":[\"top\",\"ldapsubentry\",\"nsroledefinition\",\"nssimpleroledefinition\",\"nsmanagedroledefinition\"]},\"form_fields\":{\"cn\":[],\"description\":[]}}');
+INSERT INTO `role_types` VALUES (1,'simple_managed','Standard Role','A standard role definition','{\"auto_form_fields\":[],\"fields\":{\"objectclass\":[\"top\",\"ldapsubentry\",\"nsroledefinition\",\"nssimpleroledefinition\",\"nsmanagedroledefinition\"]},\"form_fields\":{\"cn\":[],\"description\":[]}}',0);
/*!40000 ALTER TABLE `role_types` ENABLE KEYS */;
UNLOCK TABLES;
@@ -163,6 +167,7 @@ CREATE TABLE `sharedfolder_types` (
`name` varchar(256) NOT NULL,
`description` text NOT NULL,
`attributes` longtext NOT NULL,
+ `is_default` tinyint(1) DEFAULT 0,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=latin1;
@@ -174,7 +179,7 @@ CREATE TABLE `sharedfolder_types` (
LOCK TABLES `sharedfolder_types` WRITE;
/*!40000 ALTER TABLE `sharedfolder_types` DISABLE KEYS */;
-INSERT INTO `sharedfolder_types` VALUES (1,'addressbook','Shared Address Book','A shared address book','{\"auto_form_fields\":[],\"fields\":{\"kolabfoldertype\":[\"contact\"],\"objectclass\":[\"top\",\"kolabsharedfolder\"]},\"form_fields\":{\"acl\":{\"type\":\"imap_acl\",\"optional\":true,\"default\":\"anyone, lrs\"},\"cn\":[]}}'),(2,'calendar','Shared Calendar','A shared calendar','{\"auto_form_fields\":[],\"fields\":{\"kolabfoldertype\":[\"event\"],\"objectclass\":[\"top\",\"kolabsharedfolder\"]},\"form_fields\":{\"acl\":{\"type\":\"imap_acl\",\"optional\":true,\"default\":\"anyone, lrs\"},\"cn\":[]}}'),(3,'journal','Shared Journal','A shared journal','{\"auto_form_fields\":[],\"fields\":{\"kolabfoldertype\":[\"journal\"],\"objectclass\":[\"top\",\"kolabsharedfolder\"]},\"form_fields\":{\"acl\":{\"type\":\"imap_acl\",\"optional\":true,\"default\":\"anyone, lrs\"},\"cn\":[]}}'),(4,'task','Shared Tasks','A shared tasks folder','{\"auto_form_fields\":[],\"fields\":{\"kolabfoldertype\":[\"task\"],\"objectclass\":[\"top\",\"kolabsharedfolder\"]},\"form_fields\":{\"acl\":{\"type\":\"imap_acl\",\"optional\":true,\"default\":\"anyone, lrs\"},\"cn\":[]}}'),(5,'note','Shared Notes','A shared Notes folder','{\"auto_form_fields\":[],\"fields\":{\"kolabfoldertype\":[\"note\"],\"objectclass\":[\"top\",\"kolabsharedfolder\"]},\"form_fields\":{\"acl\":{\"type\":\"imap_acl\",\"optional\":true,\"default\":\"anyone, lrs\"},\"cn\":[]}}'),(6,'file','Shared Files','A shared Files folder','{\"auto_form_fields\":[],\"fields\":{\"kolabfoldertype\":[\"file\"],\"objectclass\":[\"top\",\"kolabsharedfolder\"]},\"form_fields\":{\"acl\":{\"type\":\"imap_acl\",\"optional\":true,\"default\":\"anyone, lrs\"},\"cn\":[]}}'),(7,'mail','Shared Mail Folder','A shared mail folder','{\"auto_form_fields\":[],\"fields\":{\"kolabfoldertype\":[\"mail\"],\"objectclass\":[\"top\",\"kolabsharedfolder\",\"mailrecipient\"]},\"form_fields\":{\"acl\":{\"type\":\"imap_acl\",\"optional\":true,\"default\":\"anyone, lrs\"},\"cn\":[],\"alias\":{\"type\":\"list\",\"optional\":true},\"kolabdelegate\":{\"type\":\"list\",\"autocomplete\":true,\"optional\":true},\"kolaballowsmtprecipient\":{\"type\":\"list\",\"optional\":true},\"kolaballowsmtpsender\":{\"type\":\"list\",\"optional\":true},\"kolabtargetfolder\":[],\"mail\":[]}}');
+INSERT INTO `sharedfolder_types` VALUES (1,'addressbook','Shared Address Book','A shared address book','{\"auto_form_fields\":[],\"fields\":{\"kolabfoldertype\":[\"contact\"],\"objectclass\":[\"top\",\"kolabsharedfolder\"]},\"form_fields\":{\"acl\":{\"type\":\"imap_acl\",\"optional\":true,\"default\":\"anyone, lrs\"},\"cn\":[]}}',0),(2,'calendar','Shared Calendar','A shared calendar','{\"auto_form_fields\":[],\"fields\":{\"kolabfoldertype\":[\"event\"],\"objectclass\":[\"top\",\"kolabsharedfolder\"]},\"form_fields\":{\"acl\":{\"type\":\"imap_acl\",\"optional\":true,\"default\":\"anyone, lrs\"},\"cn\":[]}}',0),(3,'journal','Shared Journal','A shared journal','{\"auto_form_fields\":[],\"fields\":{\"kolabfoldertype\":[\"journal\"],\"objectclass\":[\"top\",\"kolabsharedfolder\"]},\"form_fields\":{\"acl\":{\"type\":\"imap_acl\",\"optional\":true,\"default\":\"anyone, lrs\"},\"cn\":[]}}',0),(4,'task','Shared Tasks','A shared tasks folder','{\"auto_form_fields\":[],\"fields\":{\"kolabfoldertype\":[\"task\"],\"objectclass\":[\"top\",\"kolabsharedfolder\"]},\"form_fields\":{\"acl\":{\"type\":\"imap_acl\",\"optional\":true,\"default\":\"anyone, lrs\"},\"cn\":[]}}',0),(5,'note','Shared Notes','A shared Notes folder','{\"auto_form_fields\":[],\"fields\":{\"kolabfoldertype\":[\"note\"],\"objectclass\":[\"top\",\"kolabsharedfolder\"]},\"form_fields\":{\"acl\":{\"type\":\"imap_acl\",\"optional\":true,\"default\":\"anyone, lrs\"},\"cn\":[]}}',0),(6,'file','Shared Files','A shared Files folder','{\"auto_form_fields\":[],\"fields\":{\"kolabfoldertype\":[\"file\"],\"objectclass\":[\"top\",\"kolabsharedfolder\"]},\"form_fields\":{\"acl\":{\"type\":\"imap_acl\",\"optional\":true,\"default\":\"anyone, lrs\"},\"cn\":[]}}',0),(7,'mail','Shared Mail Folder','A shared mail folder','{\"auto_form_fields\":[],\"fields\":{\"kolabfoldertype\":[\"mail\"],\"objectclass\":[\"top\",\"kolabsharedfolder\",\"mailrecipient\"]},\"form_fields\":{\"acl\":{\"type\":\"imap_acl\",\"optional\":true,\"default\":\"anyone, lrs\"},\"cn\":[],\"alias\":{\"type\":\"list\",\"optional\":true},\"kolabdelegate\":{\"type\":\"list\",\"autocomplete\":true,\"optional\":true},\"kolaballowsmtprecipient\":{\"type\":\"list\",\"optional\":true},\"kolaballowsmtpsender\":{\"type\":\"list\",\"optional\":true},\"kolabtargetfolder\":[],\"mail\":[]}}',0);
/*!40000 ALTER TABLE `sharedfolder_types` ENABLE KEYS */;
UNLOCK TABLES;
@@ -192,6 +197,7 @@ CREATE TABLE `user_types` (
`description` text NOT NULL,
`attributes` longtext NOT NULL,
`used_for` varchar(16) DEFAULT NULL,
+ `is_default` tinyint(1) DEFAULT 0,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1;
@@ -203,7 +209,7 @@ CREATE TABLE `user_types` (
LOCK TABLES `user_types` WRITE;
/*!40000 ALTER TABLE `user_types` DISABLE KEYS */;
-INSERT INTO `user_types` VALUES (1,'kolab','Kolab User','A Kolab User','{\"auto_form_fields\":{\"alias\":{\"type\":\"list\",\"data\":[\"givenname\",\"preferredlanguage\",\"sn\"]},\"cn\":{\"data\":[\"givenname\",\"sn\"]},\"displayname\":{\"data\":[\"givenname\",\"sn\"]},\"mail\":{\"data\":[\"givenname\",\"preferredlanguage\",\"sn\"]},\"mailhost\":{\"optional\":true},\"uid\":{\"data\":[\"givenname\",\"preferredlanguage\",\"sn\"]},\"userpassword\":{\"optional\":true}},\"form_fields\":{\"alias\":{\"optional\":true},\"givenname\":[],\"initials\":{\"optional\":true},\"kolabdelegate\":{\"type\":\"list\",\"autocomplete\":true,\"optional\":true},\"kolabinvitationpolicy\":{\"type\":\"select\",\"values\":[\"\",\"ACT_MANUAL\",\"ACT_REJECT\"],\"optional\":true},\"kolaballowsmtprecipient\":{\"type\":\"list\",\"optional\":true},\"kolaballowsmtpsender\":{\"type\":\"list\",\"optional\":true},\"l\":{\"optional\":true},\"mailalternateaddress\":{\"type\":\"list\",\"optional\":true},\"mailquota\":{\"type\":\"text-quota\",\"optional\":true},\"mobile\":{\"optional\":true},\"nsroledn\":{\"type\":\"list\",\"autocomplete\":true,\"optional\":true},\"o\":{\"optional\":true},\"ou\":{\"type\":\"select\"},\"pager\":{\"optional\":true},\"postalcode\":{\"optional\":true},\"preferredlanguage\":{\"type\":\"select\"},\"sn\":[],\"street\":{\"optional\":true},\"telephonenumber\":{\"optional\":true},\"title\":{\"optional\":true},\"userpassword\":{\"optional\":true}},\"fields\":{\"objectclass\":[\"top\",\"inetorgperson\",\"kolabinetorgperson\",\"mailrecipient\",\"organizationalperson\",\"person\"]}}',NULL),(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\":{\"optional\":true}},\"form_fields\":{\"givenname\":[],\"initials\":{\"optional\":true},\"preferredlanguage\":{\"type\":\"select\",\"values\":[\"en_US\",\"de_DE\",\"de_CH\",\"en_GB\",\"fi_FI\",\"fr_FR\",\"hu_HU\"]},\"loginshell\":{\"type\":\"select\",\"values\":[\"/bin/bash\",\"/usr/bin/git-shell\",\"/sbin/nologin\"]},\"ou\":{\"type\":\"select\"},\"sn\":[],\"title\":{\"optional\":true},\"userpassword\":{\"optional\":true}},\"fields\":{\"objectclass\":[\"top\",\"inetorgperson\",\"organizationalperson\",\"person\",\"posixaccount\"]}}',NULL),(3,'kolab_posix','Mail-enabled POSIX User','A mail-enabled POSIX User','{\"auto_form_fields\":{\"alias\":{\"data\":[\"givenname\",\"preferredlanguage\",\"sn\"]},\"cn\":{\"data\":[\"givenname\",\"preferredlanguage\",\"sn\"]},\"displayname\":{\"data\":[\"givenname\",\"preferredlanguage\",\"sn\"]},\"gidnumber\":[],\"homedirectory\":{\"data\":[\"givenname\",\"preferredlanguage\",\"sn\"]},\"mail\":{\"data\":[\"givenname\",\"preferredlanguage\",\"sn\"]},\"mailhost\":{\"optional\":true},\"uid\":{\"data\":[\"givenname\",\"preferredlanguage\",\"sn\"]},\"uidnumber\":[],\"userpassword\":{\"optional\":true}},\"form_fields\":{\"alias\":{\"optional\":true},\"givenname\":[],\"initials\":{\"optional\":true},\"kolabdelegate\":{\"type\":\"list\",\"autocomplete\":true,\"optional\":true},\"kolabinvitationpolicy\":{\"type\":\"select\",\"values\":[\"\",\"ACT_MANUAL\",\"ACT_REJECT\"],\"optional\":true},\"kolaballowsmtprecipient\":{\"type\":\"list\",\"optional\":true},\"kolaballowsmtpsender\":{\"type\":\"list\",\"optional\":true},\"l\":{\"optional\":true},\"loginshell\":{\"type\":\"select\",\"values\":[\"/bin/bash\",\"/usr/bin/git-shell\",\"/sbin/nologin\"]},\"mailalternateaddress\":{\"type\":\"list\",\"optional\":true},\"mailquota\":{\"type\":\"text-quota\",\"optional\":true},\"mobile\":{\"optional\":true},\"nsroledn\":{\"type\":\"list\",\"autocomplete\":true,\"optional\":true},\"o\":{\"optional\":true},\"ou\":{\"type\":\"select\"},\"pager\":{\"optional\":true},\"postalcode\":{\"optional\":true},\"preferredlanguage\":{\"type\":\"select\"},\"sn\":[],\"street\":{\"optional\":true},\"telephonenumber\":{\"optional\":true},\"title\":{\"optional\":true},\"userpassword\":{\"optional\":true}},\"fields\":{\"objectclass\":[\"top\",\"inetorgperson\",\"kolabinetorgperson\",\"mailrecipient\",\"organizationalperson\",\"person\",\"posixaccount\"]}}',NULL),(4,'contact','Contact','A global address book contact','{\"auto_form_fields\":{\"cn\":{\"data\":[\"givenname\",\"sn\"]},\"displayname\":{\"data\":[\"givenname\",\"sn\"]},\"uid\":{\"data\":[\"givenname\",\"sn\"]},\"userpassword\":{\"optional\":true}},\"form_fields\":{\"cn\":{\"optional\":true},\"displayname\":{\"optional\":true},\"givenname\":[],\"initials\":{\"optional\":true},\"l\":{\"optional\":true},\"mail\":{\"type\":\"list\",\"optional\":true},\"mailalternateaddress\":{\"type\":\"list\",\"optional\":true},\"mobile\":{\"optional\":true},\"o\":{\"optional\":true},\"ou\":{\"type\":\"select\"},\"pager\":{\"optional\":true},\"postalcode\":{\"optional\":true},\"sn\":[],\"street\":{\"optional\":true},\"telephonenumber\":{\"optional\":true},\"title\":{\"optional\":true},\"userpassword\":{\"optional\":true}},\"fields\":{\"objectclass\":[\"top\",\"inetorgperson\",\"mailrecipient\",\"organizationalperson\",\"person\"]}}',NULL),(5,'forwarding','Mail Forwarding','A mail forwarding account (forwarding only!)','{\"auto_form_fields\":{\"cn\":{\"data\":[\"givenname\",\"sn\"]},\"displayname\":{\"data\":[\"givenname\",\"sn\"]},\"uid\":{\"data\":[\"givenname\",\"sn\"]},\"userpassword\":{\"optional\":true}},\"form_fields\":{\"cn\":{\"optional\":true},\"displayname\":{\"optional\":true},\"givenname\":[],\"initials\":{\"optional\":true},\"l\":{\"optional\":true},\"mail\":{\"type\":\"list\",\"optional\":true},\"mailalternateaddress\":{\"type\":\"list\",\"optional\":true},\"mailforwardingaddress\":{\"type\":\"list\"},\"mobile\":{\"optional\":true},\"o\":{\"optional\":true},\"ou\":{\"type\":\"select\"},\"pager\":{\"optional\":true},\"postalcode\":{\"optional\":true},\"sn\":[],\"street\":{\"optional\":true},\"telephonenumber\":{\"optional\":true},\"title\":{\"optional\":true},\"userpassword\":{\"optional\":true}},\"fields\":{\"objectclass\":[\"top\",\"inetorgperson\",\"mailrecipient\",\"organizationalperson\",\"person\"]}}',NULL);
+INSERT INTO `user_types` VALUES (1,'kolab','Kolab User','A Kolab User','{\"auto_form_fields\":{\"alias\":{\"type\":\"list\",\"data\":[\"givenname\",\"preferredlanguage\",\"sn\"]},\"cn\":{\"data\":[\"givenname\",\"sn\"]},\"displayname\":{\"data\":[\"givenname\",\"sn\"]},\"mail\":{\"data\":[\"givenname\",\"preferredlanguage\",\"sn\"]},\"mailhost\":{\"optional\":true},\"uid\":{\"data\":[\"givenname\",\"preferredlanguage\",\"sn\"]},\"userpassword\":{\"optional\":true}},\"form_fields\":{\"alias\":{\"optional\":true},\"givenname\":[],\"initials\":{\"optional\":true},\"kolabdelegate\":{\"type\":\"list\",\"autocomplete\":true,\"optional\":true},\"kolabinvitationpolicy\":{\"type\":\"select\",\"values\":[\"\",\"ACT_MANUAL\",\"ACT_REJECT\"],\"optional\":true},\"kolaballowsmtprecipient\":{\"type\":\"list\",\"optional\":true},\"kolaballowsmtpsender\":{\"type\":\"list\",\"optional\":true},\"l\":{\"optional\":true},\"mailalternateaddress\":{\"type\":\"list\",\"optional\":true},\"mailquota\":{\"type\":\"text-quota\",\"optional\":true},\"mobile\":{\"optional\":true},\"nsroledn\":{\"type\":\"list\",\"autocomplete\":true,\"optional\":true},\"o\":{\"optional\":true},\"ou\":{\"type\":\"select\"},\"pager\":{\"optional\":true},\"postalcode\":{\"optional\":true},\"preferredlanguage\":{\"type\":\"select\"},\"sn\":[],\"street\":{\"optional\":true},\"telephonenumber\":{\"optional\":true},\"title\":{\"optional\":true},\"userpassword\":{\"optional\":true}},\"fields\":{\"objectclass\":[\"top\",\"inetorgperson\",\"kolabinetorgperson\",\"mailrecipient\",\"organizationalperson\",\"person\"]}}',NULL,1),(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\":{\"optional\":true}},\"form_fields\":{\"givenname\":[],\"initials\":{\"optional\":true},\"preferredlanguage\":{\"type\":\"select\",\"values\":[\"en_US\",\"de_DE\",\"de_CH\",\"en_GB\",\"fi_FI\",\"fr_FR\",\"hu_HU\"]},\"loginshell\":{\"type\":\"select\",\"values\":[\"/bin/bash\",\"/usr/bin/git-shell\",\"/sbin/nologin\"]},\"ou\":{\"type\":\"select\"},\"sn\":[],\"title\":{\"optional\":true},\"userpassword\":{\"optional\":true}},\"fields\":{\"objectclass\":[\"top\",\"inetorgperson\",\"organizationalperson\",\"person\",\"posixaccount\"]}}',NULL,0),(3,'kolab_posix','Mail-enabled POSIX User','A mail-enabled POSIX User','{\"auto_form_fields\":{\"alias\":{\"data\":[\"givenname\",\"preferredlanguage\",\"sn\"]},\"cn\":{\"data\":[\"givenname\",\"preferredlanguage\",\"sn\"]},\"displayname\":{\"data\":[\"givenname\",\"preferredlanguage\",\"sn\"]},\"gidnumber\":[],\"homedirectory\":{\"data\":[\"givenname\",\"preferredlanguage\",\"sn\"]},\"mail\":{\"data\":[\"givenname\",\"preferredlanguage\",\"sn\"]},\"mailhost\":{\"optional\":true},\"uid\":{\"data\":[\"givenname\",\"preferredlanguage\",\"sn\"]},\"uidnumber\":[],\"userpassword\":{\"optional\":true}},\"form_fields\":{\"alias\":{\"optional\":true},\"givenname\":[],\"initials\":{\"optional\":true},\"kolabdelegate\":{\"type\":\"list\",\"autocomplete\":true,\"optional\":true},\"kolabinvitationpolicy\":{\"type\":\"select\",\"values\":[\"\",\"ACT_MANUAL\",\"ACT_REJECT\"],\"optional\":true},\"kolaballowsmtprecipient\":{\"type\":\"list\",\"optional\":true},\"kolaballowsmtpsender\":{\"type\":\"list\",\"optional\":true},\"l\":{\"optional\":true},\"loginshell\":{\"type\":\"select\",\"values\":[\"/bin/bash\",\"/usr/bin/git-shell\",\"/sbin/nologin\"]},\"mailalternateaddress\":{\"type\":\"list\",\"optional\":true},\"mailquota\":{\"type\":\"text-quota\",\"optional\":true},\"mobile\":{\"optional\":true},\"nsroledn\":{\"type\":\"list\",\"autocomplete\":true,\"optional\":true},\"o\":{\"optional\":true},\"ou\":{\"type\":\"select\"},\"pager\":{\"optional\":true},\"postalcode\":{\"optional\":true},\"preferredlanguage\":{\"type\":\"select\"},\"sn\":[],\"street\":{\"optional\":true},\"telephonenumber\":{\"optional\":true},\"title\":{\"optional\":true},\"userpassword\":{\"optional\":true}},\"fields\":{\"objectclass\":[\"top\",\"inetorgperson\",\"kolabinetorgperson\",\"mailrecipient\",\"organizationalperson\",\"person\",\"posixaccount\"]}}',NULL,0),(4,'contact','Contact','A global address book contact','{\"auto_form_fields\":{\"cn\":{\"data\":[\"givenname\",\"sn\"]},\"displayname\":{\"data\":[\"givenname\",\"sn\"]},\"uid\":{\"data\":[\"givenname\",\"sn\"]},\"userpassword\":{\"optional\":true}},\"form_fields\":{\"cn\":{\"optional\":true},\"displayname\":{\"optional\":true},\"givenname\":[],\"initials\":{\"optional\":true},\"l\":{\"optional\":true},\"mail\":{\"type\":\"list\",\"optional\":true},\"mailalternateaddress\":{\"type\":\"list\",\"optional\":true},\"mobile\":{\"optional\":true},\"o\":{\"optional\":true},\"ou\":{\"type\":\"select\"},\"pager\":{\"optional\":true},\"postalcode\":{\"optional\":true},\"sn\":[],\"street\":{\"optional\":true},\"telephonenumber\":{\"optional\":true},\"title\":{\"optional\":true},\"userpassword\":{\"optional\":true}},\"fields\":{\"objectclass\":[\"top\",\"inetorgperson\",\"mailrecipient\",\"organizationalperson\",\"person\"]}}',NULL,0),(5,'forwarding','Mail Forwarding','A mail forwarding account (forwarding only!)','{\"auto_form_fields\":{\"cn\":{\"data\":[\"givenname\",\"sn\"]},\"displayname\":{\"data\":[\"givenname\",\"sn\"]},\"uid\":{\"data\":[\"givenname\",\"sn\"]},\"userpassword\":{\"optional\":true}},\"form_fields\":{\"cn\":{\"optional\":true},\"displayname\":{\"optional\":true},\"givenname\":[],\"initials\":{\"optional\":true},\"l\":{\"optional\":true},\"mail\":{\"type\":\"list\",\"optional\":true},\"mailalternateaddress\":{\"type\":\"list\",\"optional\":true},\"mailforwardingaddress\":{\"type\":\"list\"},\"mobile\":{\"optional\":true},\"o\":{\"optional\":true},\"ou\":{\"type\":\"select\"},\"pager\":{\"optional\":true},\"postalcode\":{\"optional\":true},\"sn\":[],\"street\":{\"optional\":true},\"telephonenumber\":{\"optional\":true},\"title\":{\"optional\":true},\"userpassword\":{\"optional\":true}},\"fields\":{\"objectclass\":[\"top\",\"inetorgperson\",\"mailrecipient\",\"organizationalperson\",\"person\"]}}',NULL,0);
/*!40000 ALTER TABLE `user_types` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
diff --git a/doc/sample-insert-user_types.php b/doc/sample-insert-user_types.php
index d457f5e..a9e173d 100644
--- a/doc/sample-insert-user_types.php
+++ b/doc/sample-insert-user_types.php
@@ -149,9 +149,9 @@
),
);
- $result = $db->query("INSERT INTO `user_types` (`key`, `name`, `description`, `attributes`) " .
- "VALUES ('kolab','Kolab User', 'A Kolab User'," .
- "'" . json_encode($attributes) . "')");
+ $result = $db->query("INSERT INTO `user_types` (`key`, `name`, `description`, `attributes`, `is_default`) " .
+ "VALUES ('kolab','Kolab User', 'A Kolab User', " .
+ "'" . json_encode($attributes) . "', 1)");
$attributes = Array(
"auto_form_fields" => Array(
diff --git a/lib/api/kolab_api_service_type.php b/lib/api/kolab_api_service_type.php
index 162b29d..868018b 100644
--- a/lib/api/kolab_api_service_type.php
+++ b/lib/api/kolab_api_service_type.php
@@ -94,6 +94,7 @@ class kolab_api_service_type extends kolab_api_service
'name' => $postdata['name'],
'description' => $postdata['description'] ? $postdata['description'] : '',
'attributes' => json_encode($postdata['attributes']),
+ 'is_default' => $postdata['is_default'] ? 1 : 0,
);
if ($postdata['type'] == 'user') {
@@ -110,6 +111,11 @@ class kolab_api_service_type extends kolab_api_service
return false;
}
+ // there can be only one default
+ if ($postdata['is_default']) {
+ $this->db->query("UPDATE {$type}_types SET is_default = 0 WHERE id <> " . intval($id));
+ }
+
// update cache
$this->cache['object_types'][$type][$id] = $postdata;
@@ -182,6 +188,7 @@ class kolab_api_service_type extends kolab_api_service
'name' => $postdata['name'],
'description' => $postdata['description'] ? $postdata['description'] : '',
'attributes' => json_encode($postdata['attributes']),
+ 'is_default' => $postdata['is_default'] ? 1 : 0,
);
if ($postdata['type'] == 'user') {
@@ -199,6 +206,11 @@ class kolab_api_service_type extends kolab_api_service
return false;
}
+ // there can be only one default
+ if ($postdata['is_default']) {
+ $this->db->query("UPDATE {$type}_types SET is_default = 0 WHERE id <> " . intval($postdata['id']));
+ }
+
// update cache
$this->cache['object_types'][$type][$id] = $postdata;
diff --git a/lib/client/kolab_client_task_settings.php b/lib/client/kolab_client_task_settings.php
index 2731120..0a036a1 100644
--- a/lib/client/kolab_client_task_settings.php
+++ b/lib/client/kolab_client_task_settings.php
@@ -410,6 +410,7 @@ class kolab_client_task_settings extends kolab_client_task
'description' => 'props',
'objectclass' => 'props',
'used_for' => 'props',
+ 'is_default' => 'props',
'attributes' => 'attribs',
);
@@ -418,12 +419,7 @@ class kolab_client_task_settings extends kolab_client_task
$add_mode = empty($data['id']);
$title = $add_mode ? $this->translate('type.add') : $data['name'];
- // unset $data for correct form_create() run, we've got already data specified
- $effective_rights = $data['effective_rights'];
- $id = $data['id'] ? $data['type'].':'.$data['id'] : null;
- $data = array();
- $data['effective_rights'] = $effective_rights;
- $data['id'] = $id;
+ $data['id'] = $data['id'] ? $data['type'].':'.$data['id'] : null;
// Create form object and populate with fields
$form = $this->form_create('type', $attribs, $sections, $fields, $fields_map, $data, $add_mode);
@@ -481,6 +477,11 @@ class kolab_client_task_settings extends kolab_client_task
'type' => kolab_form::INPUT_CHECKBOX,
'checked' => !empty($data['used_for']) && $data['used_for'] == 'hosted',
),
+ 'is_default' => array(
+ 'value' => '1',
+ 'type' => kolab_form::INPUT_CHECKBOX,
+ 'checked' => !empty($data['is_default']),
+ ),
'attributes' => array(
'type' => kolab_form::INPUT_CONTENT,
'content' => $this->type_form_attributes($data),
diff --git a/lib/kolab_client_task.php b/lib/kolab_client_task.php
index ba653b8..afa4a96 100644
--- a/lib/kolab_client_task.php
+++ b/lib/kolab_client_task.php
@@ -1021,7 +1021,15 @@ class kolab_client_task
$type = $data['type_id'];
}
else {
- $data['type_id'] = $type = key($types);
+ // find default object type
+ foreach ($types as $type_id => $type) {
+ if ($type['is_default']) {
+ $default = $type_id;
+ break;
+ }
+ }
+
+ $data['type_id'] = $type = isset($default) ? $default : key($types);
}
if ($type) {
@@ -1336,7 +1344,7 @@ class kolab_client_task
$assoc_fields[$idx] = !empty($data[$idx]) ? $data[$idx] : array();
}
- if ($field['type'] == kolab_form::INPUT_CHECKBOX) {
+ if ($field['type'] == kolab_form::INPUT_CHECKBOX && !isset($field['checked'])) {
$field['checked'] = $field['value'] == 'TRUE';
}
/*
diff --git a/lib/locale/en_US.php b/lib/locale/en_US.php
index 989cfde..af4c40c 100644
--- a/lib/locale/en_US.php
+++ b/lib/locale/en_US.php
@@ -338,6 +338,7 @@ $LANG['type.delete.success'] = 'Object type deleted successfully.';
$LANG['type.domain'] = 'Domain';
$LANG['type.edit.success'] = 'Object type updated successfully.';
$LANG['type.group'] = 'Group';
+$LANG['type.is_default'] = 'Default';
$LANG['type.list'] = 'Object Types List';
$LANG['type.key'] = 'Key';
$LANG['type.name'] = 'Name';
diff --git a/public_html/js/kolab_admin.js b/public_html/js/kolab_admin.js
index 67c46f1..3fb0928 100644
--- a/public_html/js/kolab_admin.js
+++ b/public_html/js/kolab_admin.js
@@ -2619,6 +2619,7 @@ function kolab_admin()
request.type = data.type;
request.description = data.description;
request.used_for = data.used_for;
+ request.is_default = data.is_default;
request.attributes = {fields: {}, form_fields: {}, auto_form_fields: {}};
request.attributes.fields.objectclass = data.objectclass;