Apache-SiteControl
view release on metacpan or search on metacpan
lib/Apache/SiteControl.pm view on Meta::CPAN
and are defined elsewhere (see USERS). The actual web page component
should carry these objects around without implementing anything in the way of
policy.
For example, your mason component might look like this:
<HTML>
<HEAD> ... </HEAD>
% if($manager->can($currentUser, "edit", $table)) {
<FORM METHOD=POST ACTION="...">
<P><INPUT TYPE=TEXT NAME="x" VALUE="<% $table->{x} %>">
...
</FORM>
% } else {
<P>x is <% $table->{x} %>
% }
<%init>
my $currentUser = Apache::SiteControl->getCurrentUser($r);
my $manager = Apache::SiteControl->getPermissionManager($r);
sample/samplelogin.pl view on Meta::CPAN
<BODY onLoad="document.forms[0].credential_0.focus();">
<FORM METHOD="POST" ACTION="/sample/SampleLogin">
<TABLE WIDTH=60% ALIGN=CENTER VALIGN=CENTER>
<TR><TD ALIGN=CENTER>
<H1>This is a secure document</H1>
</TD></TR>
<TR><TD ALIGN=LEFT>
<P>Failure reason: '$reason'. Please enter your login and password to authenticate.</P>
</TD>
<TR><TD>
<INPUT TYPE=hidden NAME=destination VALUE="$uri">
</TD></TR>
<TR><TD>
<TABLE ALIGN=CENTER>
<TR>
<TD ALIGN=RIGHT><B>Login:</B></TD>
<TD><INPUT TYPE="text" NAME="credential_0" SIZE=10 MAXLENGTH=10></TD>
</TR>
<TR>
<TD ALIGN=RIGHT><B>Password:</B></TD>
<TD><INPUT TYPE="password" NAME="credential_1" SIZE=8 MAXLENGTH=8></TD>
</TR>
<TR>
<TD COLSPAN=2 ALIGN=CENTER><INPUT TYPE="submit" VALUE="Continue"></TD>
</TR></TABLE>
</TD></TR></TABLE>
</FORM>
</BODY>
</HTML>
HERE
$r->no_cache(1);
my $x = length($form);
$r->content_type("text/html");
sample/site/index.html view on Meta::CPAN
</TR><TR>
<TD>Favorite color:</TD>
<TD>
<SELECT NAME="color">
<% colorList($preferences) %>
</SELECT>
</TD>
</TR><TR>
<TD>Age:</TD>
<TD>
<INPUT TYPE=TEXT NAME="age"
VALUE="<% $preferences->{"age"} %>">
</TD>
</TR>
</TABLE>
<P><INPUT TYPE=Submit>
</FORM>
% } else {
<TABLE>
<TR>
<TD>Name:</TD><TD><% $currentUser %></TD>
</TR><TR>
<TD>Favorite color:</TD>
<TD><% $preferences->{"favoriteColor"} %></TD>
</TR><TR>
<TD>Age:</TD>
( run in 0.241 second using v1.01-cache-2.11-cpan-4e96b696675 )