steffen: server/perl-kolab/Kolab-LDAP LDAP.pm,1.31.2.4,1.31.2.5

cvs at intevation.de cvs at intevation.de
Tue Sep 13 00:14:15 CEST 2005


Author: steffen

Update of /kolabrepository/server/perl-kolab/Kolab-LDAP
In directory doto:/tmp/cvs-serv14973/Kolab-LDAP

Modified Files:
      Tag: kolab_2_0_branch
	LDAP.pm 
Log Message:
Prevent creation of mailboxes for external users

Index: LDAP.pm
===================================================================
RCS file: /kolabrepository/server/perl-kolab/Kolab-LDAP/LDAP.pm,v
retrieving revision 1.31.2.4
retrieving revision 1.31.2.5
diff -u -d -r1.31.2.4 -r1.31.2.5
--- LDAP.pm	12 Sep 2005 19:56:09 -0000	1.31.2.4
+++ LDAP.pm	12 Sep 2005 22:14:13 -0000	1.31.2.5
@@ -234,6 +234,7 @@
     my $p = shift || 'user';
     my $doacls = shift || 0;
     my $objuidfield = shift || ($p eq 'user' ? 'mail' : ($p eq 'sf' ? 'cn' : ''));
+    my $is_external = ($object->dn =~ /.*,cn=external,$Kolab::config{'base_dn'}/);
 
     Kolab::log('L', "Kolab::LDAP::createObject() called with obj uid field `$objuidfield' for obj type `$p'", KOLAB_DEBUG);
 
@@ -302,10 +303,12 @@
             Kolab::log('L', "Creating user `$uid' corresponding to GUID `$guid'", KOLAB_DEBUG);
             # We have a object that we have no previous record of, so create everything
             if ($sync) { $newuid_db{$guid} = $uid; } else { $uid_db{$guid} = $uid; }
-            Kolab::Cyrus::createMailbox($cyrus, $uid, ($p eq 'sf' ? 1 : 0));
-	    if( $p ne 'sf' && !$islocal ) {
-	      # Hide user mailboxes on other servers
-	      Kolab::Cyrus::setACL($cyrus,$uid,0, ["$uid rswipcda"]);
+	    if( !$is_external ) {
+	      Kolab::Cyrus::createMailbox($cyrus, $uid, ($p eq 'sf' ? 1 : 0));
+	      if( $p ne 'sf' && !$islocal ) {
+		# Hide user mailboxes on other servers
+		Kolab::Cyrus::setACL($cyrus,$uid,0, ["$uid rswipcda"]);
+	      }
 	    }
 #	    if( $p ne 'sf' ) {
 #	      # Create FB dir for user
@@ -317,14 +320,15 @@
         }
     }
 
-    if ($doacls) {
+    if( !$is_external ) {
+      if ($doacls) {
         my $acls = $object->get_value('acl', 'asref' => 1);
         Kolab::Cyrus::setACL($cyrus, $uid, ($p eq 'sf' ? 1 : 0), mapAcls( $acls, ($p eq 'sf' ? 1:0)));
+      }
+      my $quota = $object->get_value($Kolab::config{$p . '_field_quota'});
+      defined($quota) or ($quota = 0);
+      Kolab::Cyrus::setQuota($cyrus, $uid, $quota*1024, ($p eq 'sf' ? 1 : 0));
     }
-
-    my $quota = $object->get_value($Kolab::config{$p . '_field_quota'});
-    defined($quota) or ($quota = 0);
-    Kolab::Cyrus::setQuota($cyrus, $uid, $quota*1024, ($p eq 'sf' ? 1 : 0));
 }
 
 sub createMasterLDAP {
@@ -364,6 +368,7 @@
     my $object = shift;
     my $remfromldap = shift || 0;
     my $p = shift || 'user';
+    my $is_external = ($object->dn =~ /.*,cn=external,$Kolab::config{'base_dn'}/);
 
     if ($remfromldap) {
         my $dn = $object->dn;
@@ -455,7 +460,9 @@
 
     Kolab::DirServ::genericRequest($object, "remove alias") if $p eq 'user';
 
-    Kolab::Cyrus::deleteMailbox($cyrus, $uid, ($p eq 'sf' ? 1 : 0));
+    if( !$is_external ) {
+      Kolab::Cyrus::deleteMailbox($cyrus, $uid, ($p eq 'sf' ? 1 : 0));
+    }
 #    if( $p ne 'sf' ) {
 #      # Create FB dir for user
 #      my $fbdir = $Kolab::config{'prefix'}.'/var/kolab/www/freebusy/'.$uid;





More information about the commits mailing list