ispman/lib/ISPMan UserMan.pm,1.58.4.10,1.58.4.11

Pedro Algarvio <[email protected]> Thu, 26 Oct 2006 04:03:25 +0000
Newsgroups gmane.comp.isp.ispman.cvs
Message-ID <[email protected]>
Update of /cvsroot/ispman/ispman/lib/ISPMan
In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv4877/lib/ISPMan

Modified Files:
      Tag: dev_1_3-cyrus_virtdomain2
	UserMan.pm 
Log Message:
Added the changes which earlier broked behaviour, now working. Suposedly this is to help future merge with HEAD.


Index: UserMan.pm
===================================================================
RCS file: /cvsroot/ispman/ispman/lib/ISPMan/UserMan.pm,v
retrieving revision 1.58.4.10
retrieving revision 1.58.4.11
diff -u -d -r1.58.4.10 -r1.58.4.11
--- UserMan.pm	26 Oct 2006 03:31:03 -0000	1.58.4.10
+++ UserMan.pm	26 Oct 2006 04:03:23 -0000	1.58.4.11
@@ -50,6 +50,7 @@
 
   addUserFileServerProcess
   containsInvalidMailAliases
+  getDNForMailAddress
 );
 
 $VERSION = '0.01';
@@ -58,8 +59,8 @@
     my $self   = shift;
     my $r      = shift;
     my $domain = $r->param("ispmanDomain");
-    print
-"Sorry cannot add users to a replica domain<br>Instead add users to its master domain which is ";
+    print "Sorry cannot add users to a replica domain<br>"
+    . "Instead add users to its master domain which is ";
     my $replicaMaster =
       $self->getEntry(
         "ispmanDomain=$domain, $self->{'Config'}->{'ldapBaseDN'}",
@@ -123,8 +124,10 @@
       $self->getDomainAttribute( $domain, "ispmanMaxAccounts" );
     my $domainUserCount = $self->getUserCount($domain);
     if ( $domainMaxUsers > 0 && $domainUserCount >= $domainMaxUsers ) {
-        $self->{'message'} =
-"Max accounts limit exceeded. <br>Your limit is $domainMaxUsers <br>You cannot create any more users.";
+        $self->{'message'} = 
+        "Max accounts limit exceeded. <br>"
+      . "Your limit is $domainMaxUsers <br>"
+      . "You cannot create any more users.";
         print $self->{'message'};
         return;
     }
@@ -143,17 +146,11 @@
     $self->prepareBranchForDN(
         "ou=users, ispmanDomain=$domain, @{[$self->getConf('ldapBaseDN')]}");
 
-# get domain info and supply it to session data so we can use it in user ldif template
+    # get domain info and supply it to session data
+    # so we can use it in user ldif template
     my $domain_info = $self->getDomainInfo( $r->param("ispmanDomain") );
     $r->param( "domaininfo", $domain_info );
 
-# moved to user template
-#my $homeDirectory=join '/', ($domain_info->{'homeDirectory'}, "users", $r->param("uid"), "");
-#my $cn=($r->param("givenName") && $r->param("sn"))? join " ", ($r->param("givenName"), $r->param("sn")) :$r->param("userid");
-#$r->param("cn", $cn);
-#$r->param("sn", ($r->param("sn")? $r->param("sn"):$r->param("userid")));
-#$r->param("homeDirectory", $homeDirectory);
-
     # validate ftp quota
     if (   $r->param("FTPQuotaMBytes") !~ /\d\d*/
         || $r->param("FTPQuotaMBytes") < 0 )
@@ -189,9 +186,9 @@
             "quota=$quota");
         }
 
-      # send the process to method addUserFileServerProcess
-      # the process will only be sent to fileHost if one is defined
-      # if not defined then we fall back to the old method and send to the filserver group
+        # send the process to method addUserFileServerProcess
+        # the process will only be sent to fileHost if one is defined
+        # if not defined then we fall back to the old method and send to the filserver group
 
         # passing domain, username, process and username as params
         $self->addUserFileServerProcess( $domain, $_uid,
@@ -206,6 +203,18 @@
 
 }
 
+sub getDNForMailAddress {
+    my $self  = shift;
+    my $found = "";
+    while ( ! $found && (my $mail = shift )) {
+        my $entries =
+          $self->getEntriesAsHashRef( $self->{'Config'}->{'ldapBaseDN'},
+            "|(mailLocalAddress=$mail)(mailAlias=$mail)" );
+        ($found) = keys %$entries;
+    }
+    return $found;
+}
+
 sub getUserInfo {
     my $self = shift;
     my $uid  = shift;
@@ -247,7 +256,6 @@
     print "Deleting $dn<br>";
     $self->{'user'} = $self->{'ldap'}->getEntryAsHashRef($dn);
 
-
     #it is possible that as user has multiple uids.
     #hint
     #aghaffar_ispman_org
@@ -258,12 +266,13 @@
 
     # first send processes.
 
-# %%% new method %%
-# send the process to method addUserFileServerProcess
-# the process will only be sent to fileHost if one is defined
-# if not defined then we fall back to the old method and send to the filserver group
+    # %%% new method %%
+    # send the process to method addUserFileServerProcess
+    # the process will only be sent to fileHost if one is defined
+    # if not defined then we fall back to the old method and
+    # send to the filserver group
 
-# passing domain, username, process and username,homedirecory,uid,gid  as params
+    # passing domain, username, process and username,homedirecory,uid,gid  as params
 
     $self->addUserFileServerProcess(
         $self->{'user'}{'ispmanDomain'},


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642