ispman/lib/ISPMan UserMan.pm,1.49,1.50

Joerg Delker <[email protected]>
Newsgroups gmane.comp.isp.ispman.cvs
Message-ID <[email protected]>
Update of /cvsroot/ispman/ispman/lib/ISPMan
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9275/lib/ISPMan

Modified Files:
	UserMan.pm 
Log Message:
some API changes
editUser: removed DN as passing param (security issue)
getUsers: removed DN as passing param (security issue)
getDomainUsersForDomain: obsoleted


Index: UserMan.pm
===================================================================
RCS file: /cvsroot/ispman/ispman/lib/ISPMan/UserMan.pm,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -d -r1.49 -r1.50
--- UserMan.pm	21 Jun 2004 20:07:32 -0000	1.49
+++ UserMan.pm	15 Jul 2004 07:41:49 -0000	1.50
@@ -33,7 +33,6 @@
   getUsersBranchDN
   getUserDN
   fixDuplicateUsers
-  getDomainUsersForDomain
   getMailAliasesForUser
   addMailAliasForUser
   replaceMailAliasForUser
@@ -216,8 +215,11 @@
 sub editUser {
     my $self = shift;
     my $r    = shift;
-    my $dn   = $r->param("dn");
-    $self->{'user'} = $self->getEntryAsHashRef( $r->param("dn") );
+
+    my $dn = $self->getUserDN( $r->param("ispmanDomain"), $r->param("uid") );
+
+    $self->{'user'} = $self->getEntryAsHashRef($dn);
+
     my $template;
     if ( $self->isDomainEditable( $r->param("ispmanDomain") ) ) {
         $template = $self->getTemplate("users/edit.tmpl");
@@ -446,18 +448,21 @@
     return join( ",", "uid=$uid", $self->getUsersBranchDN($domain) );
 }
 
-sub getDomainUsersForDomain {
+sub getUsers {
     my $self   = shift;
     my $domain = shift;
+    my $attr   = shift || [ "cn", "uid" ];
     my $branch = $self->getUsersBranchDN($domain);
-    my $users  = $self->getEntriesAsHashRef(
-        $branch,
-        "objectclass=ispmanDomainUser",
-        [ "cn", "uid" ]
-    );
-    return $self->fixDuplicateUsers($users);
+    my $users  =
+      $self->getEntriesAsHashRef( $branch, "objectclass=ispmanDomainUser",
+        $attr );
+    return $users;
+
+    #return $self->fixDuplicateUsers($users);
 }
 
+# FIXME:
+# This is a method for presentation layer (circumventing it for now)
 sub fixDuplicateUsers {
     my $self     = shift;
     my $userhash = shift;
@@ -478,17 +483,6 @@
     return $user;
 }
 
-sub getUsers {
-    my $self     = shift;
-    my $dn       = shift;
-    my $userhash = $self->getEntriesAsHashRef(
-        $dn,
-        "objectclass=ispmanDomainUser",
-        [ "cn", "uid" ]
-    );
-    return $self->fixDuplicateUsers($userhash);
-}
-
 sub searchUsers {
     my $self     = shift;
     my $template = $self->getTemplate("users/search.tmpl");
@@ -550,9 +544,9 @@
     my $self = shift;
     my ( $userId, $domain ) = @_;
 
-   # here is the logic to convert userName to user_domain_tld
-   # If you don't want this behaviour and just wasn't uid uncomment the next line;
-   # return $userId;
+ # here is the logic to convert userName to user_domain_tld
+ # If you don't want this behaviour and just wasn't uid uncomment the next line;
+ # return $userId;
 
     $domain =~ s/\./_/g;
     $userId =~ s/\./_/g;



-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.