ispman/lib/ISPMan/ApacheMan Acls.pm,1.5,1.6

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

Modified Files:
	Acls.pm 
Log Message:
Add,Delete,Modify functions are working without any serverside checks. i-e trying to protect a url with no user will result in LDAP error.

Functions in form verb_noun are functions that can be used by CLI.
Other Interfaces should call them to do the job instead of rewritting the login.

Currently CCP is using deleteAcl, addACL, updateAcl. This should be changed so it used add_acl, update_acl, delete_acl as they are also being used by CLI and admin panel.


Index: Acls.pm
===================================================================
RCS file: /cvsroot/ispman/ispman/lib/ISPMan/ApacheMan/Acls.pm,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- Acls.pm	13 Jan 2004 14:39:25 -0000	1.5
+++ Acls.pm	13 Jan 2004 16:08:50 -0000	1.6
@@ -13,8 +13,13 @@
 getAcls
 addAcl
 add_acl
-updateAcl
-deleteAcl
+addVhostAcl
+updateAcl
+update_acl
+updateVhostAcl
+deleteAcl
+deleteVhostAcl
+delete_acl
 
 );
 $VERSION = '0.01';
@@ -62,7 +67,7 @@
 sub addVhostAcl {
 	my $self=shift;
     my $r=shift;
-	if ($self->AclExists($r->param('newIspmanVhostAclLocation')) {
+	if ($self->AclExists($r->param('newIspmanVhostAclLocation'))) {
       $r->param("errors", "An ACL for this location already exists.");
    } else {
       $r->param("ispmanVhostAclLocation", $r->param("newIspmanVhostAclLocation"));
@@ -87,8 +92,7 @@
 
 
 
-
-sub updateAcl {
+sub updateAcl { #used by CCP. Should be obseleted and instead delete_acl should be used with domain, vhost and url as params
    my $self=shift;
    my $r=shift;
 
@@ -98,21 +102,60 @@
 	});
    $self->addVhostProcess($r->param("ispmanDomain"), $r->param("ispmanVhostName"), "ModifyVirtualHost", $r->param("ispmanVhostName"));
 }
+
+
+sub updateVhostAcl { # used by the admin panel
+   my $self=shift;
+   my $r=shift;
+   $self->update_acl($r->param('ispmanDomain'), $r->param('ispmanVhostName'), $r->param('ispmanVhostAclLocation'), $r->param('ispmanVhostAclAllowUser'));
+   $r->delete("ispmanVhostAclLocation");
+   $r->param("mode", "editVhost");
+   $r->param("section", "acls");
+   $self->editVhost($r);
+}
+
+sub update_acl{
+   my $self=shift;
+   my ($domain, $vhost, $url, @users)=@_;
+   my $aclDN=$self->getAclDN($domain, $vhost, $url);
+   $self->updateEntryWithData($aclDN, {
+      'ispmanVhostAclLocation' => $url,
+      'ispmanVhostAclAllowUser' => $self->as_arrayref(@users)
+	});
+   $self->addVhostProcess($domain, $vhost, "ModifyVirtualHost", $vhost);
+}
 
 
+sub deleteVhostAcl {
+   my $self=shift;
+   my $r=shift;
+   $self->delete_acl($r->param('ispmanDomain'), $r->param('ispmanVhostName'), $r->param('ispmanVhostAclLocation'));
+   $r->delete("ispmanVhostAclLocation");
+   $r->param("mode", "editVhost");
+   $r->param("section", "acls");
+   $self->editVhost($r);
+}
 
 
-sub deleteAcl {
+sub deleteAcl {  #used by CCP. Should be obseleted and instead delete_acl should be used with domain, vhost and url as params
    my $self=shift;
    my $r=shift;
    print "Deleting ", $r->param('dn');
-
+   
    if ($self->deleteEntry($r->param('dn'))){
       $self->addVhostProcess($r->param("ispmanDomain"), $r->param("ispmanVhostName"), "ModifyVirtualHost", $r->param("ispmanVhostName"));
    }
 
 
 }
+sub delete_acl {
+    my $self=shift;
+    my ($domain, $vhost, $url)=@_;
+    my $aclDN=$self->getAclDN($domain, $vhost, $url);
+   if ($self->deleteEntry($aclDN)){
+      $self->addVhostProcess($domain,$vhost, "ModifyVirtualHost", $vhost);
+   }
+}
 
 
 




-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software.
Perforce is the Fast Software Configuration Management System offering
advanced branching capabilities and atomic changes on 50+ platforms.
Free Eval! http://www.perforce.com/perforce/loadprog.html
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.