martin: server/kolab-webadmin/kolab-webadmin/www/admin/user user.php, 1.22, 1.23

cvs at intevation.de cvs at intevation.de
Thu Aug 12 04:20:08 CEST 2004


Author: martin

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

Modified Files:
	user.php 
Log Message:
Martin K.: Fix for issue 288 (Possible to create two users with the same UID)


Index: user.php
===================================================================
RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/www/admin/user/user.php,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- user.php	6 Aug 2004 15:45:05 -0000	1.22
+++ user.php	12 Aug 2004 02:20:05 -0000	1.23
@@ -1,7 +1,7 @@
 <?php
 /*
  (c) 2004 Klarlvdalens Datakonsult AB
-
+ (c) 2004 Martin Konold erfrakon <martin.konold at erfrakon.de>
  This program is Free Software under the GNU General Public License (>=v2).
  Read the file COPYING that comes with this packages for details.
 */
@@ -66,12 +66,32 @@
   foreach( $lst as $alias ) {
 	debug( "looking at $alias, exluding $dn" );
 	if( $ldap->countMail( $_SESSION['base_dn'], $alias, $excludedn ) > 0 ) {
-	  $str .= _('Mail address ').htmlentities($alias)._(' already exists<br />');
+	  $str .= _('Email address ').htmlentities($alias)._(' collision <br />');
 	}
   }
   return $str;
 }
 
+function checkuid( $form, $key, $value ) {
+  print "checkuid";
+  global $ldap;
+  global $action;
+  global $dn;
+  $excludedn = false;
+  if( $action == 'save' ) $excludedn = trim($dn);
+  $lst = array_unique( array_filter( array_map( 'trim', preg_split( '/\n/', $value ) ), 'strlen') );
+  $str = '';
+  foreach( $lst as $uid ) {
+    print ("looking at uid = $uid, exluding $dn" );
+    if( $ldap->countMail( $_SESSION['base_dn'], $uid, $excludedn ) > 0 ) {
+      $str .= _('UID ').htmlentities($uid)._(' collision <br />');
+    }
+  }
+  return $str;
+}
++
++
+
 function checkdelegate( $form, $key, $value ) {
   global $ldap;
   global $action;
@@ -80,7 +100,7 @@
   $lst = array_unique( array_filter( array_map( 'trim', preg_split( '/\n/', $value ) ), 'strlen') );
   $str = '';
   foreach( $lst as $delegate ) {
-	if( $ldap->count( $ldap->search( $_SESSION['base_dn'], '(uid='.$ldap->escape($delegate).')' ) ) == 0 ) {
+	if( $ldap->count( $ldap->search( $_SESSION['base_dn'], '(mail='.$ldap->escape($delegate).')' ) ) == 0 ) {
 	  return _("Delegate $delegate does not exist");
 	} 
   }
@@ -259,7 +279,7 @@
 				     'validation' => 'notempty',
 				     'comment' => $comment_mail_0 ),
 		  'uid'    => array( 'name' => _('Unique Identity (UID)'),
-                                     #'validation' => '',
+                                     'validation' => 'checkuid',
                                      'comment' => _('Optional - Defaults to Primary Email Address') ),
                  'homeserver' => array( 'name' => _('Mailbox Home Server'),
 								 'validation' => 'notempty',





More information about the commits mailing list