Projects
Kolab:3.4
kolab-webadmin
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 55
View file
kolab-webadmin.spec
Changed
@@ -35,7 +35,7 @@ Name: kolab-webadmin Version: 3.2.6 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Kolab Groupware Server Web Administration Interface License: AGPLv3+ Group: Productivity/Office/Organizers @@ -43,6 +43,8 @@ Source0: http://mirror.kolabsys.com/pub/releases/%{name}-%{version}.tar.gz +Patch: feature-autogenerate-kolabtargetfolder.patch + BuildArch: noarch BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -77,7 +79,9 @@ Web based admin - and user interface for the Kolab Groupware Server %prep -%setup -q +%setup -q + +%patch0 -p1 for file in `find . -type f -name "*.enterprise"`; do if [ 0%{?kolab_enterprise} -gt 0 ]; then @@ -167,6 +171,9 @@ %attr(0770,%{httpd_user},%{httpd_group}) %{_var}/log/%{name} %changelog +* Thu Feb 19 2015 Daniel Hoffend <dh@dotlan.net> - 3.2.6-1 +- Feature: Autogenerated kolabtargetfolder for shared mail folders #3335 + * Fri Jan 23 2015 Jeroen van Meeuwen <vanmeeuwen@kolabsys.com> - 3.2.6-1 - Upstream release of version 3.2.6
View file
feature-autogenerate-kolabtargetfolder.patch
Added
@@ -0,0 +1,149 @@ +diff --git a/doc/kolab_wap.sql b/doc/kolab_wap.sql +index 871c130..1338ba4 100644 +--- a/doc/kolab_wap.sql ++++ b/doc/kolab_wap.sql +@@ -179,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\":[]}}',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); ++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','{\"fields\":{\"objectclass\":[\"kolabsharedfolder\",\"mailrecipient\",\"top\"],\"kolabfoldertype\":\"mail\"},\"form_fields\":{\"acl\":{\"type\":\"imap_acl\",\"optional\":true,\"default\":\"anyone, lrs\"},\"alias\":{\"type\":\"list\",\"optional\":true},\"cn\":[],\"kolaballowsmtprecipient\":{\"type\":\"list\",\"optional\":true},\"kolaballowsmtpsender\":{\"type\":\"list\",\"optional\":true},\"kolabdelegate\":{\"type\":\"list\",\"autocomplete\":true,\"optional\":true},\"mail\":[]},\"auto_form_fields\":{\"kolabtargetfolder\":{\"data\":[\"cn\"]}}}',0); + /*!40000 ALTER TABLE `sharedfolder_types` ENABLE KEYS */; + UNLOCK TABLES; + +diff --git a/lib/api/kolab_api_service_form_value.php b/lib/api/kolab_api_service_form_value.php +index 230cff6..320acf9 100644 +--- a/lib/api/kolab_api_service_form_value.php ++++ b/lib/api/kolab_api_service_form_value.php +@@ -566,6 +566,31 @@ class kolab_api_service_form_value extends kolab_api_service + } + } + ++ private function generate_kolabtargetfolder_sharedfolder($postdata, $attribs = array()) ++ { ++ if (isset($attribs['auto_form_fields']) && isset($attribs['auto_form_fields']['kolabtargetfolder'])) { ++ // Use Data Please ++ foreach ($attribs['auto_form_fields']['kolabtargetfolder']['data'] as $key) { ++ if (!isset($postdata[$key])) { ++ throw new Exception("Key not set: " . $key, 12356); ++ } ++ } ++ ++ // no cn given then return empty ++ if (!trim($postdata['cn'])) { ++ return ''; ++ } ++ ++ // check format (will throw exception) ++ $this->validate_cn_sharedfolder($postdata['cn']); ++ ++ $cn = $postdata['cn']; ++ $imap_hierarchysep = '/'; ++ ++ return $cn ? 'shared' . $imap_hierarchysep . $cn . '@' . $_SESSION['user']->get_domain() : ''; ++ } ++ } ++ + private function generate_kolabtargetfolder_resource($postdata, $attribs = array()) + { + if (isset($attribs['auto_form_fields']) && isset($attribs['auto_form_fields']['kolabtargetfolder'])) { +@@ -1299,6 +1324,28 @@ class kolab_api_service_form_value extends kolab_api_service + return 'OK'; + } + ++ private function validate_cn_sharedfolder($value, $postdata = array(), $validation_type = null) ++ { ++ if (preg_match('/["\'@%+^]/',$value)) { ++ throw new Exception("Folder name contains invalid characters: \" ' @ % + ^"); ++ } ++ ++ return 'OK'; ++ } ++ ++ private function validate_kolabtargetfolder_sharedfolder($value, $postdata = array(), $validation_type = null) ++ { ++ $domains = $this->_get_valid_domains(); ++ if (!preg_match('#^shared/[^"\'\\+@%^]+@('.implode("|",$domains).')$#',$value)) { ++ throw new Exception("Target IMAP Folder has to match the following format: 'shared/foldername@mydomain.org' and the foldername can't contain invalid characters: \" ' @ % + ^"); ++ } ++ ++ // TODO: check for duplicate shared folder ++ // same kolabTargetFolder && type = 'mail || type != mail && folderpart == cn (other) ++ ++ return 'OK'; ++ } ++ + private function _list_options_members($postdata, $attribs = array()) + { + // return specified records only, by exact DN attributes +@@ -1549,32 +1596,22 @@ class kolab_api_service_form_value extends kolab_api_service + return $valid; + } + +- private function _validate_email_address_in_any_of_my_domains($mail_address) ++ private function _get_valid_domains($my_primary_domain = null) + { +- $at_index = strrpos($mail_address, "@"); +- if (is_bool($at_index) && !$at_index) { +- throw new Exception("Invalid email address: No domain name space", 235); +- } else { +- $email_domain = substr($mail_address, $at_index+1); +- } +- +- $my_primary_domain = $_SESSION['user']->get_domain(); +- +- if ($email_domain == $my_primary_domain) { +- return true; +- } ++ $my_primary_domain = $my_primary_domain !== null ++ ? $my_primary_domain ++ : $_SESSION['user']->get_domain(); + + $auth = Auth::get_instance(); + $conf = Conf::get_instance(); + $all_domains = $auth->list_domains(); + $all_domains = $all_domains['list']; +- $valid_domains = array(); + $dna = $conf->get('domain_name_attribute'); +- $valid = false; + +- Log::trace("_validate_email_address_in_any_of_mydomains(\$mail_address = " . var_export($mail_address, TRUE) . ")"); +- Log::trace("\$all_domains includes: " . var_export($all_domains, TRUE) . " (must include domain for \$mail_address)"); ++ Log::trace("__get_valid_domains( " . $my_primary_domain . ")"); ++ Log::trace("\$all_domains includes: " . var_export($all_domains, TRUE) . " (must include domain for \$my_primary_domain)"); + ++ $valid_domains = array(); + foreach ($all_domains as $domain_id => $domain_attrs) { + if (!is_array($domain_attrs[$dna])) { + $domain_attrs[$dna] = (array)($domain_attrs[$dna]); +@@ -1585,7 +1622,29 @@ class kolab_api_service_form_value extends kolab_api_service + } + } + +- if (in_array($email_domain, $valid_domains)) { ++ return $valid_domains; ++ } ++ ++ private function _validate_email_address_in_any_of_my_domains($mail_address) ++ { ++ $at_index = strrpos($mail_address, "@"); ++ if (is_bool($at_index) && !$at_index) { ++ throw new Exception("Invalid email address: No domain name space", 235); ++ } else { ++ $email_domain = substr($mail_address, $at_index+1); ++ } ++ ++ $my_primary_domain = $_SESSION['user']->get_domain(); ++ ++ if ($email_domain == $my_primary_domain) { ++ Log::trace("Found email address to be in one of my domains."); ++ return true; ++ } ++ ++ $valid = false; ++ Log::trace("_validate_email_address_in_any_of_mydomains(\$mail_address = " . var_export($mail_address, TRUE) . ")"); ++ ++ if (in_array($email_domain, $this->_get_valid_domains($my_primary_domain))) { + $valid = true; + } +
View file
debian.changelog
Changed
@@ -1,3 +1,9 @@ +kolab-webadmin (3.2.6-0~kolab2) unstable; urgency=low + + * Feature: Autogenerated kolabtargetfolder for shared mail folders #3335 + + -- Daniel Hoffend <dh@dotlan.net> Thu, 19 Feb 2015 01:00:00 +0100 + kolab-webadmin (3.2.6-0~kolab1) unstable; urgency=low * New upstream release 3.2.6
View file
debian.series
Changed
@@ -0,0 +1,1 @@ +feature-autogenerate-kolabtargetfolder.patch -p1
View file
kolab-webadmin.dsc
Changed
@@ -2,7 +2,7 @@ Source: kolab-webadmin Binary: kolab-webadmin Architecture: all -Version: 3.2.6-0~kolab1 +Version: 3.2.6-0~kolab2 Maintainer: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com> Uploaders: Paul Klos <kolab@klos2day.nl> Homepage: http://www.kolab.org/
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.