summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGunnar Wrobel <wrobel@pardus.de>2010-03-23 18:02:11 (GMT)
committerGunnar Wrobel <wrobel@pardus.de>2010-03-23 18:02:11 (GMT)
commita3e6cedc9867833cd2ca6bfb4e75a14b5879447f (patch)
tree43819eae1662335ee44ea4c58c127bc83b1b08ef
parentd6c7a513dde893bba0b5057c29ce58c5218960aa (diff)
downloadperl-Kolab-a3e6cedc9867833cd2ca6bfb4e75a14b5879447f.tar.gz
kolab/issue4237 (additional event.default folder created by kolabd (rt#6038))
-rw-r--r--ChangeLog5
-rw-r--r--lib/Kolab/Cyrus.pm32
-rw-r--r--lib/Kolab/LDAP.pm4
3 files changed, 38 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index b5221e6..e1b03bc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2010-03-23 Gunnar Wrobel <p@rdus.de>
+
+ * lib/Kolab/Cyrus.pm (createCalendar): kolab/issue4237 (additional
+ event.default folder created by kolabd (rt#6038))
+
2010-03-11 Gunnar Wrobel <p@rdus.de>
* bin/kolabpasswd.in: kolab/issue919 (kolab server has
diff --git a/lib/Kolab/Cyrus.pm b/lib/Kolab/Cyrus.pm
index 647ba98..99d51af 100644
--- a/lib/Kolab/Cyrus.pm
+++ b/lib/Kolab/Cyrus.pm
@@ -40,6 +40,7 @@ our %EXPORT_TAGS = (
&create
&createUid
&createMailbox
+ &createCalendar
&deleteMailbox
&setQuota
&setACL
@@ -110,6 +111,37 @@ sub createMailbox
}
}
+sub createCalendar
+{
+ my $cyrus = shift;
+ my $user = shift;
+ my $domain = shift;
+ my $folder = shift;
+ my $acl = shift;
+
+ my $calendar = 0;
+
+ my @mailboxes = $cyrus->list("user/$user/*\@$domain");
+ my %info;
+ foreach my $mailbox (@mailboxes) {
+ my $u = @{$mailbox}[0];
+ %info = $cyrus->info($u, ('/vendor/kolab/folder-type'));
+ if ($info{'/vendor/kolab/folder-type'} == 'event.default') {
+ $calendar = $u;
+ }
+ }
+
+ if ($calendar) {
+ Kolab::log('Y', "Skipping calendar creation for $user\@$domain as $calendar is a default calendar.", KOLAB_DEBUG);
+ } else {
+ Kolab::log('Y', "Creating default calendar for $user\@$domain.", KOLAB_DEBUG);
+ createMailbox($cyrus, $folder, 0);
+ setFolderType($cyrus, $folder, 0, 'event.default');
+ setACL($cyrus, $folder, 0, $acl);
+ Kolab::log('Y', "Successfully created default calendar for $user\@$domain.", KOLAB_DEBUG);
+ }
+}
+
sub setQuota
{
my $cyrus = shift;
diff --git a/lib/Kolab/LDAP.pm b/lib/Kolab/LDAP.pm
index 946f792..2f36c89 100644
--- a/lib/Kolab/LDAP.pm
+++ b/lib/Kolab/LDAP.pm
@@ -568,9 +568,7 @@ sub createObject
$domain = $Kolab::config{'postfix-mydomain'};
}
my $folder = $user . '/Calendar@' . $domain;
- Kolab::Cyrus::createMailbox($cyrus, $folder, 0);
- Kolab::Cyrus::setFolderType($cyrus, $folder, 0, 'event.default');
- Kolab::Cyrus::setACL($cyrus, $folder, 0, ["$uid all", 'calendar@' . $domain .' all']);
+ Kolab::Cyrus::createCalendar($cyrus, $user, $domain, $folder, ["$uid all", 'calendar@' . $domain .' all']);
}
}
}