steffen: server/kolab-webadmin/kolab-webadmin/www/admin/sharedfolder index.php, 1.7, 1.8 sf.php, 1.20, 1.21

cvs at intevation.de cvs at intevation.de
Fri Jul 8 04:05:37 CEST 2005


Author: steffen

Update of /kolabrepository/server/kolab-webadmin/kolab-webadmin/www/admin/sharedfolder
In directory doto:/tmp/cvs-serv12403/kolab-webadmin/kolab-webadmin/www/admin/sharedfolder

Modified Files:
	index.php sf.php 
Log Message:
multidomain shared folders. New folder have the domain encoded in CN, existing folders work as before

Index: index.php
===================================================================
RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/www/admin/sharedfolder/index.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- index.php	11 Mar 2005 09:11:15 -0000	1.7
+++ index.php	8 Jul 2005 02:05:35 -0000	1.8
@@ -17,7 +17,8 @@
 /**** Authentication etc. ***/
 $sidx = 'sf';
 
-if( $auth->group() != 'maintainer' && $auth->group() != 'admin') {
+$group = $auth->group();
+if( $group != 'maintainer' && $group != 'admin' && $group != 'domain-maintainer' ) {
    array_push($errors, _("Error: You don't have Permissions to access this Menu"));
 }
 
@@ -28,11 +29,23 @@
 
 /**** Extract data from LDAP ***/
 
+function prepare_domain_filter_component($str) {
+  return '(cn=*@'.KolabLDAP::escape($str).')';
+}
+
 // Get all entries & dynamically split the letters with growing entries
 if( !$errors ) {
   if (isset($_SESSION['base_dn'])) $base_dn = $_SESSION['base_dn'];
   else $base_dn = 'k=kolab';
-  $filter = "(&(cn=*)(objectclass=kolabSharedFolder))";
+  if( $group == 'domain-maintainer' ) {
+	$domainfilter = '(|'.join('', array_map( 'prepare_domain_filter_component', 
+											 $ldap->domainsForMaintainerDn($auth->dn()))).')';
+	
+  } else {
+	$domainfilter = '(cn=*)';
+  }
+  debug("domainfilter=$domainfilter");
+  $filter = "(&$domainfilter(objectclass=kolabSharedFolder))";
   $result = ldap_search($ldap->connection, $base_dn, $filter);
   if( $result ) {
 	$count = ldap_count_entries($ldap->connection, $result);

Index: sf.php
===================================================================
RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/www/admin/sharedfolder/sf.php,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- sf.php	4 May 2005 14:50:40 -0000	1.20
+++ sf.php	8 Jul 2005 02:05:35 -0000	1.21
@@ -20,7 +20,8 @@
 $contenttemplate = 'formcontainer.tpl';
 $valid_actions = array('firstsave','save','modify','create','delete','kill');
 
-if( $auth->group() != 'maintainer' && $auth->group() != 'admin') {
+$group = $auth->group();
+if( $group != 'maintainer' && $group != 'admin' && $group != 'domain-maintainer' ) {
    array_push($errors, _("Error: You don't have Permissions to access this Menu"));
 }
 
@@ -113,10 +114,11 @@
 $dn="";
 if (!empty($_REQUEST['dn'])) $dn = trim($_REQUEST['dn']);
 
-if (!$errors && $auth->group() != 'maintainer' && $auth->group() != 'admin') 
-	 array_push($errors, _("Error: You don't have the required Permissions"));
-
 $entries = array( 'cn' => array( 'name' => _('Folder Name'),
+								 'type' => 'email',
+								 'domains' => ($auth->group()=='domain-maintainer')
+								 ?$ldap->domainsForMaintainerDn($auth->dn())
+								 :$ldap->domains(),
 								 'validation' => 'notempty',
 								 'comment' => _('Required') ),
 				  'kolabhomeserver' => array( 'name' => _('Folder Location'),
@@ -163,7 +165,7 @@
 		// OK, we need to get the name down to lowercase ascii only
 		// we handle a few common cases here
 		// Really cheesy, but strtolower is latin1 only :-(
-		$cn = trim($_POST['cn']);
+		$cn = empty($_POST['domain_cn'])?trim($_POST['user_cn']):trim($_POST['user_cn']).'@'.$_POST['domain_cn'];
 		debug("cn=$cn");
 		$cn = strtolower(utf8_decode($cn));
 		debug("cn=$cn");





More information about the commits mailing list