?? passwd-body.jsp
字號:
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<%@ taglib uri="/tags/struts-tiles" prefix="tiles" %>
<%@ page import="openwfe.org.auth.Grant" %>
<%@ page import="openwfe.org.uman.web.Definitions" %>
<%@ page import="openwfe.org.uman.web.WumanSession" %>
<script language="javascript">
function submitAddPrincipalForm (actionTarget)
{
form = document.forms["addPrincipal"];
submitForm(form, actionTarget);
}
function submitAddGrantForm (actionTarget)
{
form = document.forms["addGrant"];
submitForm(form, actionTarget);
}
function submitAddPermissionForm (actionTarget)
{
form = document.forms["addPermission"];
submitForm(form, actionTarget);
}
function submitForm (form, actionTarget)
{
form.action=actionTarget;
form.method="POST";
form.submit();
}
</script>
<%
// in the crevecoeur, listening to "From dusk till dawn", music from the
// motion picture
WumanSession wumanSession = (WumanSession)session
.getAttribute(Definitions.WUMAN_SESSION);
%>
<!-- PRINCIPALS -->
<table border=0 width=790>
<tr>
<td colspan=4 align=left>--Principals--</td>
</tr>
<tr bgcolor=#d3d3d3>
<td><i>name</i></td>
<td><i>class</i></td>
<td colspan=2><i>grants</i></td>
</tr>
<%
boolean colored = false;
%>
<logic:iterate
id="p"
name="wumanSession"
property="principalValues"
scope="session"
>
<%
openwfe.org.auth.Principal principal = (openwfe.org.auth.Principal)p;
if (colored) { %><tr bgcolor=#d3d3d3><% } else { %><tr><% }
colored = ! colored;
%>
<!-- name -->
<td valign=top><%= principal.getName() %><br>
<!-- 'buttons' -->
<small><a href="/editItem.action?principalName=<%= principal.getName() %>"><img src=/images/edit.png border=0></a> <a href="/removePrincipal.action?principalName=<%= principal.getName() %>"><img src=/images/minus.png border=0></a></small></td>
<!-- class -->
<td valign=top><%= principal.getClass().getName() %></td>
<!-- grants -->
<td valign=top><small><%
java.util.Iterator it = principal.getGrants().iterator();
while(it.hasNext())
{
String grantName = (String)it.next();
out.print
("<a href=/removeGrant.action?grantName="+grantName+
"&principalName="+principal.getName()+
"><img src=/images/minus.png border=0></a> ");
out.print(grantName);
if (it.hasNext()) out.print("<br>");
}
%></small></td>
<td valign=top><small><%
it = wumanSession.getGrantNames().iterator();
while (it.hasNext())
{
String grantName = (String)it.next();
if ( ! principal.getGrants().contains(grantName))
{
%><a href="/addGrant.action?grantName=<%= grantName %>&principalName=<%= principal.getName() %>"><img src=/images/plus.png border=0></a> <%
out.print(grantName);
if (it.hasNext())
{
out.print("<br>");
}
}
}
%></small></td>
</tr>
</logic:iterate>
<tr>
<!-- add principal -->
<td colspan=4 align=left><form
name="addPrincipal"
><select name="class">
<%
java.util.Iterator it = wumanSession
.getHandledClasses(openwfe.org.auth.Principal.class).iterator();
while (it.hasNext())
{
%><option><%= it.next().toString() %></option><%
}
%>
</select> <a href="" onClick='submitAddPrincipalForm("/editItem.action"); return false;'><img src=/images/plus.png border=0></a></form></td>
</tr>
</table>
<br>
<br>
<!-- GRANTS -->
<table border=0 width=790>
<tr>
<td colspan=5 align=left>--Grants--</td>
</tr>
<tr bgcolor=#d3d3d3>
<td><i>name</i></td>
<td><i>codebase and permissions</i></td>
</tr>
<%
colored = false;
int permissionFormId = 0;
%>
<logic:iterate
id="g"
name="wumanSession"
property="grantValues"
scope="session"
>
<!-- the grant itself -->
<%
openwfe.org.auth.Grant grant = (openwfe.org.auth.Grant)g;
if (colored) { %><tr bgcolor=#d3d3d3><% } else { %><tr><% }
colored = ! colored;
%>
<!-- name -->
<td valign=top><%= grant.getName() %><br>
<!-- buttons -->
<small><a href="/editItem.action?grantName=<%= grant.getName() %>"><img src=/images/edit.png border=0></a> <a href="/removeGrant.action?grantName=<%= grant.getName() %>"><img src=/images/minus.png border=0></a></small></td>
<!-- codebase -->
<td valign=top><font size=1><%= grant.getUrl() %><br>
<br></font>
<table border=0 cellpadding=0 cellspacing=0 width=100%>
<tr>
<td><small><i>class</i></small></td>
<td><small><i>name</i></small></td>
<td><small><i>rights</i></small></td>
<td></td>
</tr>
<logic:iterate
id="p"
name="g"
property="permissionValues"
><%
java.security.Permission permission = (java.security.Permission)p;
%><tr>
<td><small><%= permission.getClass().getName() %></small></td>
<td><small><%= permission.getName() %></small></td>
<td><small><%= permission.getActions() %></small></td>
<td align=right><small><a href="/editItem.action?grantName=<%= grant.getName() %>&permissionKey=<%= Grant.computeKey(permission)%>"><img src=/images/edit.png border=0></a> <a href="/removePermission.action?grantName=<%= grant.getName() %>&permissionKey=<%= Grant.computeKey(permission)%>"><img src=/images/minus.png border=0></a></small></td>
</tr>
</logic:iterate>
<tr>
<!--
<td colspan=4 align=left><a href="addPermission.action?grantName=<%= grant.getName() %>">add a new Permission</a></td>
-->
<!-- add permission -->
<!-- some javascript just for the next form here -->
<script language="javascript">
function submitAddPermissionForm<%= permissionFormId %> (actionTarget)
{
form = document.forms["addPermission<%= permissionFormId %>"];
submitForm(form, actionTarget);
}
</script>
<td colspan=4 align=left><form
name="addPermission<%= permissionFormId %>"
><input
type=hidden
name=grantName
value="<%= grant.getName() %>"
><select
name="class"
><%
it = wumanSession
.getHandledClasses(java.security.Permission.class)
.iterator();
while (it.hasNext())
{
out.print("\n"); // fancy output ;-)
%><option><%= it.next().toString() %></option><%
}
%>
</select> <a href="" onClick='submitAddPermissionForm<%= permissionFormId %>("/editItem.action"); return false;'><img src=/images/plus.png border=0></a></form></td>
</tr></table><font size=1><br>
</font></td>
<% permissionFormId++; %>
</tr>
</logic:iterate>
<tr>
<!-- add grant -->
<td colspan=4 align=left><form
name="addGrant"
><select name="class">
<%
it = wumanSession
.getHandledClasses(openwfe.org.auth.Grant.class).iterator();
while (it.hasNext())
{
%><option><%= it.next().toString() %></option><%
}
%>
</select> <a href="" onClick='submitAddGrantForm("/editItem.action"); return false;'><img src=/images/plus.png border=0></a></form></td>
</tr>
</table>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -