steffen: server/perl-kolab/Kolab-LDAP LDAP.pm,1.10,1.11

cvs at intevation.de cvs at intevation.de
Thu Jul 8 13:43:50 CEST 2004


Author: steffen

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

Modified Files:
	LDAP.pm 
Log Message:
make mapping between kolab and cyrus acls explicit and remove admin rights from shared folders

Index: LDAP.pm
===================================================================
RCS file: /kolabrepository/server/perl-kolab/Kolab-LDAP/LDAP.pm,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- LDAP.pm	29 Jun 2004 19:27:08 -0000	1.10
+++ LDAP.pm	8 Jul 2004 11:43:48 -0000	1.11
@@ -184,6 +184,27 @@
     return ($del =~ /true/i);
 }
 
+# Map from Kolab ACLs to Cyrus ACLs
+sub mapAcls {
+  my $acls = shift;
+  my $sf = shift || 0;
+  my @acls = map {
+    my ($uid,$perm) = split(/\s+/,$_,2);
+    if( lc $perm eq 'none' ) { $_ = "$uid none"; }
+    elsif( lc $perm eq 'read' ) { $_ = "$uid lrs"; }
+    elsif( lc $perm eq 'append' ) { $_ = "$uid lrsi"; }
+    elsif( lc $perm eq 'write' ) { $_ = "$uid lrsiwcd"; }
+    elsif( lc $perm eq 'read anon' ) { $_ = "$uid lr"; }
+    elsif( lc $perm eq 'read hidden' ) { $_ = "$uid rs"; }
+    elsif( lc $perm eq 'all' ) { if( $sf ) { $_ = "$uid lrsiwcd"; } else { $_ = "$uid lrsiwcda"; } }
+    else { $_ = "$uid $perm"; } # passthrough
+  } @$acls;
+  if( $sf ) {
+    # Do we need to push admin rights for manager?
+  }
+  return \@acls;
+}
+
 sub createObject
 {
     my $ldap = shift;
@@ -267,7 +288,7 @@
 
     if ($doacls) {
         my $acls = $object->get_value('acl', 'asref' => 1);
-        Kolab::Cyrus::setACL($cyrus, $uid, ($p eq 'sf' ? 1 : 0), $acls);
+        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'});





More information about the commits mailing list