ispman/ispman-web/cgi-bin/tmpl/vhosts edit_acls.tmpl,NONE,1.1

[email protected]
Newsgroups gmane.comp.isp.ispman.cvs
Message-ID <[email protected]>
Update of /cvsroot/ispman/ispman/ispman-web/cgi-bin/tmpl/vhosts
In directory sc8-pr-cvs1:/tmp/cvs-serv16908

Added Files:
	edit_acls.tmpl 
Log Message:
initial ci of acl file. derived from the control panel

--- NEW FILE: edit_acls.tmpl ---
<table>
<tr>
    <td valign=top>
        <perl>_("Website  Access control")</perl>  <br>
        
        </td>
    <td>
        <font  color=white><i>
        </font>
        </td>
</tr>
<tr>
<td colspan=2>                        
<table border=1>
                <tr class=header>
                        <td><perl>_("Protected area")</perl></td>
                        <td><perl>_("Allowed users")</perl></td>
                        <td colspan=2>&nbsp;</td>                               
                </tr>
            <perl>
           my $ACLs=$ispman->getAcls($r->param("ispmanDomain"), $r->param('ispmanVhostName'));
           my $text="";
           if ($ACLs){
                $text.="<tr><td colspan=4 class=control>";
                $text.=_("The following rules are defined ");
                $text.="</td></tr>";
                
                my $vhost = join '.', ($r->param("ispmanVhostName"), $r->param('ispmanDomain'));
                $text.= $vhost;
                $text.="<br><br>";
                
                
                for (sort {length($b) <=> length($a)} keys %$ACLs){ 
                        $text.="<tr>";
                        if ($r->param("ispmanVhostAclLocation") && $r->param("ispmanVhostAclLocation") eq $ACLs->{$_}{'ispmanVhostAclLocation'}){
                                $text.=qq|<td valign=top><input type=text name=ispmanVhostAclLocation value='$ACLs->{$_}{'ispmanVhostAclLocation'}'></td>
                                <td valign=top> <select name=ispmanVhostAclAllowUser multiple size=5>|;
                                   my $allowedUsers={};
                                   for my $allowedUser (@{$ACLs->{$_}{'ispmanVhostAclAllowUser'}}){
                                        $allowedUsers->{$allowedUser}++;
                                   }
                                   
                                   my $webusers=$ispman->getWebUsers(($r->param('ispmanDomain'));
                                    for $webuser(keys %$webusers){
                                        $text.="<option value='$webusers->{$webuser}{'ispmanUserId'}'";
                                        if ($allowedUsers->{$webusers->{$webuser}{'ispmanUserId'}}) {
                                                $text.=" selected ";
                                        }
                                        $text.=">webuser: $webusers->{$webuser}{'ispmanUserId'}</option>\n";
                                        
                                    }
                                    my $domainusers=$ispman->getDomainUsersForDomain($r->param('ispmanDomain'));
                                    for $domainuser(keys %$domainusers){
                                        $text.="<option value='$domainuser'";
                                        if ($allowedUsers->{$domainuser}) {
                                                $text.=" selected ";
                                        }
                                        $text.=">domainuser: $domainuser</option>\n";
                                        
                                    }
                                   
                                
                                $text.=qq|
                                </select>
                                </td>
                                <td><input type=button value='@{[_("update")]}' onClick='updateAcl()'></td>
                                <input type=hidden name=ispmanVhostAclLocation value="$ACLs->{$_}{'ispmanVhostAclLocation'}">
                                <input type=hidden name=dn value="$_">
                                <td><a href="@{[$r->url]}?mode=deleteWebsiteAcl&section=AccessControl&vhost=@{[$r->param("vhost")]}&ispmanVhostAclLocation=$ACLs->{$_}{'ispmanVhostAclLocation'}">@{[$customer->getText('Delete')]}</a></td>
                                |;
                        } else {
                                $text.=qq|
                                <td><font color=blue>$ACLs->{$_}{'ispmanVhostAclLocation'}</font></td>
                                <td> <font color=green>|;
                                if (ref $ACLs->{$_}{'ispmanVhostAclAllowUser'} eq "ARRAY") {
                                        $text.= join ', ', @{$ACLs->{$_}{'ispmanVhostAclAllowUser'}};
                                } else {
                                        $text.=$ACLs->{$_}{'ispmanVhostAclAllowUser'};
                                }
                                
                                $text.=qq|
                                </font></td>
                                <td><a href="@{[$r->url]}?mode=editVhost&section=AccessControl&vhost=@{[$r->param("vhost")]}&ispmanVhostAclLocation=$ACLs->{$_}{'ispmanVhostAclLocation'}">@{[$customer->getText('Edit')]}</a></td>
                                <td><a href="@{[$r->url]}?mode=deleteWebsiteAcl&section=AccessControl&vhost=@{[$r->param("vhost")]}&ispmanVhostAclLocation=$ACLs->{$_}{'ispmanVhostAclLocation'}">@{[$customer->getText('Delete')]}</a></td>
                                |;
                        }
                        
                        $text.="<tr>";
                }
            } else {
                $text.="<tr><td colspan=4 class=control>";
                $text.=_("No Website ACL defined ");
                $text.="</td></tr>";
            }                                        
            $text
            </perl>
                
                <tr class=control>
                        <td valign=top class=control><input type=text name=newlocation value=""></td>
                        <td valign=top class=control>
                        <select MULTIPLE size=5 name=newallow>
                        <perl>
                            my $webusers=$ispman->getWebUsers(($r->param('ispmanDomain'));
                            for $webuser(keys %$webusers){
                                $text.="<option value='$webusers->{$webuser}{'ispmanUserId'}'>webuser: $webusers->{$webuser}{'ispmanUserId'}</option>";
                            }
                            $text
                        </perl>
                        
                        <perl>
                            $text="";
                            my $users=$ispman->getDomainUsersForDomain($r->param('ispmanDomain'));
				            for my $user(keys %$users) {
                                $text.="<option value='$user'>domainuser: $user</option>\n";
                            }
                        $text
                        </perl>
                        </select>
                        </td>
                        <td colspan=2><input type=button value="<perl>_('Add  new protected area')</perl>" onclick="addAcl(this.form)"></td>
                        <input type=hidden name=mode value="addWebsiteAcl">
                        
                </tr>
                                                        
        </table>                
</td>
</tr>
</table>






-------------------------------------------------------
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.