[seam-commits] Seam SVN: r10187 - in trunk/seam-gen: contrib and 6 other directories.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Thu Mar 19 00:23:03 EDT 2009
Author: dan.j.allen
Date: 2009-03-19 00:23:03 -0400 (Thu, 19 Mar 2009)
New Revision: 10187
Added:
trunk/seam-gen/resources/import-identity-management.sql
trunk/seam-gen/resources/security-identity-management.drl
trunk/seam-gen/src/UserAccount.java
trunk/seam-gen/src/UserPermission.java
trunk/seam-gen/src/UserRole.java
trunk/seam-gen/view/img/btnmanageroles.png
trunk/seam-gen/view/img/btnmanageusers.png
trunk/seam-gen/view/img/btnnewpermission.png
trunk/seam-gen/view/img/btnnewrole.png
trunk/seam-gen/view/img/btnnewuser.png
trunk/seam-gen/view/img/false.png
trunk/seam-gen/view/img/true.png
trunk/seam-gen/view/useradmin/
trunk/seam-gen/view/useradmin/home.xhtml
trunk/seam-gen/view/useradmin/roledetail.page.xml
trunk/seam-gen/view/useradmin/roledetail.xhtml
trunk/seam-gen/view/useradmin/rolemanager.page.xml
trunk/seam-gen/view/useradmin/rolemanager.xhtml
trunk/seam-gen/view/useradmin/userdetail.page.xml
trunk/seam-gen/view/useradmin/userdetail.xhtml
trunk/seam-gen/view/useradmin/usermanager.page.xml
trunk/seam-gen/view/useradmin/usermanager.xhtml
Modified:
trunk/seam-gen/build.xml
trunk/seam-gen/contrib/seam-completion
trunk/seam-gen/icefaces/view/login.xhtml
trunk/seam-gen/view/login.xhtml
Log:
JBSEAM-3717
Modified: trunk/seam-gen/build.xml
===================================================================
--- trunk/seam-gen/build.xml 2009-03-19 04:21:28 UTC (rev 10186)
+++ trunk/seam-gen/build.xml 2009-03-19 04:23:03 UTC (rev 10187)
@@ -553,6 +553,7 @@
<include name="hibernatetools/**"/>
<include name="lib/**"/>
<include name="resources/**"/>
+ <exclude name="resources/*identity-management*"/>
<include name="pojo/**"/>
<include name="src/**"/>
<include name="test/**"/>
@@ -565,6 +566,7 @@
<include name="build-scripts/**"/>
<include name="ide-project-files/**"/>
<include name="resources/**"/>
+ <exclude name="resources/*identity-management*"/>
<include name="src/**"/>
<include name="view/**"/>
</fileset>
@@ -864,6 +866,7 @@
<exclude name="META-INF/jboss-app.xml"/>
<exclude name="META-INF/ejb-jar.xml"/>
<exclude name="WEB-INF/jboss-web.xml"/>
+ <exclude name="*identity-management*"/>
</fileset>
<filterset refid="project"/>
<filterset refid="jdbc"/>
@@ -1149,6 +1152,60 @@
<delete dir="${project.home}"/>
</target>
+ <target name="add-identity-management" depends="validate-project" if="project.exists"
+ description="Add Seam's identity management components and views to the project.">
+ <fail message="Currently the identity management is only configured to support RichFaces projects" if="icefaces.property"/>
+ <copy todir="${project.home}/view">
+ <fileset dir="${templates.dir}/view">
+ <include name="useradmin/**"/>
+ <include name="stylesheet/useradmin.css"/>
+ <include name="img/btn*"/>
+ <include name="img/true.png"/>
+ <include name="img/false.png"/>
+ </fileset>
+ </copy>
+ <copy todir="${project.home}/src/${model.dir}">
+ <fileset dir="${templates.dir}/src">
+ <include name="User*.java"/>
+ </fileset>
+ <filterset refid="project"/>
+ </copy>
+ <replace file="${project.home}/view/layout/menu.xhtml">
+ <replacetoken><![CDATA[<!-- @newMenuItem@ -->]]></replacetoken>
+ <replacevalue><![CDATA[<s:link view="/useradmin/home.xhtml" value="Identity Management" propagation="none" rendered="#{true or identity.hasRole('admin')}"/> <!-- temporarily enabled for all -->
+ <!-- @newMenuItem@ -->]]></replacevalue>
+ </replace>
+ <replace file="${project.home}/resources/WEB-INF/components.xml">
+ <replacetoken><![CDATA[<security:identity authenticate-method="#{authenticator.authenticate}" remember-me="true"/>]]></replacetoken>
+ </replace>
+ <replace file="${project.home}/resources/WEB-INF/components.xml">
+ <replacetoken><![CDATA[</components>]]></replacetoken>
+ <replacevalue><![CDATA[ <security:jpa-identity-store
+ user-class="@modelPackage at .UserAccount"
+ role-class="@modelPackage at .UserRole"/>
+
+ <security:jpa-permission-store user-permission-class="@modelPackage at .UserPermission"/>
+
+ <security:remember-me enabled="true"/>
+
+</components>]]></replacevalue>
+ </replace>
+
+ <replace file="${project.home}/resources/WEB-INF/components.xml">
+ <replacefilter token="@modelPackage@" value="${model.package}"/>
+ </replace>
+ <concat destfile="${project.home}/resources/security.drl" append="true">
+ <fileset file="${templates.dir}/resources/security-identity-management.drl"/>
+ </concat>
+ <concat destfile="${project.home}/resources/import-dev.sql" append="true">
+ <fileset file="${templates.dir}/resources/import-identity-management.sql"/>
+ </concat>
+ <echo message="Identity management has been added to the project!"/>
+ <echo message="Verify the <identity:security> component is no longer defined in resources/WEB-INF/components.xml"/>
+ <echo message="You'll now need to restart the application with hibernate.hbm2ddl.auto set to 'create', 'create-drop' or 'update' for the new tables to be created."/>
+ <echo message="If you use 'update', you will need to manually run the SQL statements appended to resources/import-dev.sql to add the default accounts."/>
+ </target>
+
<target name="new-action" depends="new-action-ear,new-action-war"
description="Create a new action"/>
<target name="new-form" depends="new-form-ear,new-form-war"
Modified: trunk/seam-gen/contrib/seam-completion
===================================================================
--- trunk/seam-gen/contrib/seam-completion 2009-03-19 04:21:28 UTC (rev 10186)
+++ trunk/seam-gen/contrib/seam-completion 2009-03-19 04:23:03 UTC (rev 10187)
@@ -13,7 +13,7 @@
if [ $invalid != 0 ]; then
COMPREPLY=( $( compgen -W 'help setup' -- $cur ) )
else
- COMPREPLY=( $( compgen -W 'help setup create-project update-project delete-project deploy undeploy explode restart unexplode archive clean test new-action new-form new-conversation new-entity new-query generate generate-model generate-ui settings reset' -- $cur ) )
+ COMPREPLY=( $( compgen -W 'help setup create-project update-project update-seam delete-project deploy undeploy redeploy explode unexplode reexplode restart archive clean test new-action new-form new-conversation new-entity new-query new-test generate generate-model generate-ui settings reset add-ivy add-identity-management' -- $cur ) )
fi
}
complete -F _seam seam
Modified: trunk/seam-gen/icefaces/view/login.xhtml
===================================================================
--- trunk/seam-gen/icefaces/view/login.xhtml 2009-03-19 04:21:28 UTC (rev 10186)
+++ trunk/seam-gen/icefaces/view/login.xhtml 2009-03-19 04:23:03 UTC (rev 10187)
@@ -33,7 +33,7 @@
value="#{identity.password}"/>
<h:outputLabel for="rememberMe">Remember me</h:outputLabel>
<ice:selectBooleanCheckbox id="rememberMe"
- value="#{identity.rememberMe}"/>
+ value="#{rememberMe.enabled}"/>
</ice:panelGrid>
</div>
Added: trunk/seam-gen/resources/import-identity-management.sql
===================================================================
--- trunk/seam-gen/resources/import-identity-management.sql (rev 0)
+++ trunk/seam-gen/resources/import-identity-management.sql 2009-03-19 04:23:03 UTC (rev 10187)
@@ -0,0 +1,7 @@
+
+insert into user_account (id, username, password_hash, enabled) values (1, 'admin', 'Ss/jICpf9c9GeJj8WKqx1hUClEE=', 1); -- blank password
+insert into user_role (id, name, conditional) values (1, 'admin', false);
+insert into user_role (id, name, conditional) values (2, 'member', false);
+insert into user_role (id, name, conditional) values (3, 'guest', true);
+insert into user_account_role (account_id, member_of_role) values (1, 1);
+insert into user_role_group (role_id, member_of_role) values (1, 2);
Added: trunk/seam-gen/resources/security-identity-management.drl
===================================================================
--- trunk/seam-gen/resources/security-identity-management.drl (rev 0)
+++ trunk/seam-gen/resources/security-identity-management.drl 2009-03-19 04:23:03 UTC (rev 10187)
@@ -0,0 +1,20 @@
+
+/******************************************************************************************
+ This rule supports the administration of users and roles using Seam's identity management.
+ ******************************************************************************************/
+rule ManageAccount
+ no-loop
+ // The first rule in an activation-group to fire will cancel the
+ // other rules activations (stop them from firing). The activation
+ // group can be any string, as long as the string is identical for
+ // all the rules you need to be in the one group.
+ activation-group "permissions"
+when
+ $perm: PermissionCheck(name == "seam.user" || == "seam.role", granted == false)
+ Role(name == "admin")
+then
+ $perm.grant();
+end
+/******************************************************************************************
+ This rules supports the administration of users and roles using Seam's identity management.
+ ******************************************************************************************/
Added: trunk/seam-gen/src/UserAccount.java
===================================================================
--- trunk/seam-gen/src/UserAccount.java (rev 0)
+++ trunk/seam-gen/src/UserAccount.java 2009-03-19 04:23:03 UTC (rev 10187)
@@ -0,0 +1,83 @@
+package @modelPackage@;
+
+import java.io.Serializable;
+import java.util.Set;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.JoinTable;
+import javax.persistence.ManyToMany;
+import javax.persistence.Table;
+import javax.persistence.UniqueConstraint;
+
+import org.hibernate.validator.NotNull;
+import org.jboss.seam.annotations.security.management.UserEnabled;
+import org.jboss.seam.annotations.security.management.UserPassword;
+import org.jboss.seam.annotations.security.management.UserPrincipal;
+import org.jboss.seam.annotations.security.management.UserRoles;
+
+ at Entity
+ at Table(uniqueConstraints = @UniqueConstraint(columnNames = "username"), name = "user_account")
+public class UserAccount implements Serializable {
+ private static final long serialVersionUID = 6368734442192368866L;
+
+ private Long id;
+ private String username;
+ private String passwordHash;
+ private boolean enabled;
+
+ private Set<UserRole> roles;
+
+ @Id
+ @GeneratedValue
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ @NotNull
+ @UserPrincipal
+ public String getUsername() {
+ return username;
+ }
+
+ public void setUsername(String username) {
+ this.username = username;
+ }
+
+ @UserPassword(hash = "SHA")
+ @Column(name = "password_hash")
+ public String getPasswordHash() {
+ return passwordHash;
+ }
+
+ public void setPasswordHash(String passwordHash) {
+ this.passwordHash = passwordHash;
+ }
+
+ @UserEnabled
+ public boolean isEnabled() {
+ return enabled;
+ }
+
+ public void setEnabled(boolean enabled) {
+ this.enabled = enabled;
+ }
+
+ @UserRoles
+ @ManyToMany
+ @JoinTable(name = "user_account_role", joinColumns = @JoinColumn(name = "account_id"), inverseJoinColumns = @JoinColumn(name = "member_of_role"))
+ public Set<UserRole> getRoles() {
+ return roles;
+ }
+
+ public void setRoles(Set<UserRole> roles) {
+ this.roles = roles;
+ }
+}
Added: trunk/seam-gen/src/UserPermission.java
===================================================================
--- trunk/seam-gen/src/UserPermission.java (rev 0)
+++ trunk/seam-gen/src/UserPermission.java 2009-03-19 04:23:03 UTC (rev 10187)
@@ -0,0 +1,84 @@
+package @modelPackage@;
+
+import java.io.Serializable;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import org.jboss.seam.annotations.security.permission.PermissionAction;
+import org.jboss.seam.annotations.security.permission.PermissionDiscriminator;
+import org.jboss.seam.annotations.security.permission.PermissionRole;
+import org.jboss.seam.annotations.security.permission.PermissionTarget;
+import org.jboss.seam.annotations.security.permission.PermissionUser;
+
+ at Entity
+ at Table(name = "user_permission")
+public class UserPermission implements Serializable
+{
+ private static final long serialVersionUID = -5628863031792429938L;
+
+ private Long id;
+ private String recipient;
+ private String target;
+ private String action;
+ private String discriminator;
+
+ @Id @GeneratedValue
+ public Long getId()
+ {
+ return id;
+ }
+
+ public void setId(Long id)
+ {
+ this.id = id;
+ }
+
+ @PermissionUser
+ @PermissionRole
+ public String getRecipient()
+ {
+ return recipient;
+ }
+
+ public void setRecipient(String recipient)
+ {
+ this.recipient = recipient;
+ }
+
+ @PermissionTarget
+ public String getTarget()
+ {
+ return target;
+ }
+
+ public void setTarget(String target)
+ {
+ this.target = target;
+ }
+
+ @PermissionAction
+ public String getAction()
+ {
+ return action;
+ }
+
+ public void setAction(String action)
+ {
+ this.action = action;
+ }
+
+ @PermissionDiscriminator
+ public String getDiscriminator()
+ {
+ return discriminator;
+ }
+
+ public void setDiscriminator(String discriminator)
+ {
+ this.discriminator = discriminator;
+ }
+
+}
Added: trunk/seam-gen/src/UserRole.java
===================================================================
--- trunk/seam-gen/src/UserRole.java (rev 0)
+++ trunk/seam-gen/src/UserRole.java 2009-03-19 04:23:03 UTC (rev 10187)
@@ -0,0 +1,69 @@
+package @modelPackage@;
+
+import java.io.Serializable;
+import java.util.Set;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.JoinTable;
+import javax.persistence.ManyToMany;
+import javax.persistence.Table;
+
+import org.hibernate.validator.NotNull;
+import org.jboss.seam.annotations.security.management.RoleConditional;
+import org.jboss.seam.annotations.security.management.RoleGroups;
+import org.jboss.seam.annotations.security.management.RoleName;
+
+ at Entity
+ at Table(name = "user_role")
+public class UserRole implements Serializable {
+ private static final long serialVersionUID = 9177366120789064801L;
+
+ private Long id;
+ private String name;
+ private boolean conditional;
+
+ private Set<UserRole> groups;
+
+ @Id
+ @GeneratedValue
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ @RoleName
+ @NotNull
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ @RoleGroups
+ @ManyToMany
+ @JoinTable(name = "user_role_group", joinColumns = @JoinColumn(name = "role_id"), inverseJoinColumns = @JoinColumn(name = "member_of_role"))
+ public Set<UserRole> getGroups() {
+ return groups;
+ }
+
+ public void setGroups(Set<UserRole> groups) {
+ this.groups = groups;
+ }
+
+ @RoleConditional
+ public boolean isConditional() {
+ return conditional;
+ }
+
+ public void setConditional(boolean conditional) {
+ this.conditional = conditional;
+ }
+}
Added: trunk/seam-gen/view/img/btnmanageroles.png
===================================================================
(Binary files differ)
Property changes on: trunk/seam-gen/view/img/btnmanageroles.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/seam-gen/view/img/btnmanageusers.png
===================================================================
(Binary files differ)
Property changes on: trunk/seam-gen/view/img/btnmanageusers.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/seam-gen/view/img/btnnewpermission.png
===================================================================
(Binary files differ)
Property changes on: trunk/seam-gen/view/img/btnnewpermission.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/seam-gen/view/img/btnnewrole.png
===================================================================
(Binary files differ)
Property changes on: trunk/seam-gen/view/img/btnnewrole.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/seam-gen/view/img/btnnewuser.png
===================================================================
(Binary files differ)
Property changes on: trunk/seam-gen/view/img/btnnewuser.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/seam-gen/view/img/false.png
===================================================================
(Binary files differ)
Property changes on: trunk/seam-gen/view/img/false.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/seam-gen/view/img/true.png
===================================================================
(Binary files differ)
Property changes on: trunk/seam-gen/view/img/true.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/seam-gen/view/login.xhtml
===================================================================
--- trunk/seam-gen/view/login.xhtml 2009-03-19 04:21:28 UTC (rev 10186)
+++ trunk/seam-gen/view/login.xhtml 2009-03-19 04:23:03 UTC (rev 10187)
@@ -27,7 +27,7 @@
value="#{credentials.password}"/>
<h:outputLabel for="rememberMe">Remember me</h:outputLabel>
<h:selectBooleanCheckbox id="rememberMe"
- value="#{identity.rememberMe}"/>
+ value="#{rememberMe.enabled}"/>
</h:panelGrid>
</div>
Added: trunk/seam-gen/view/useradmin/home.xhtml
===================================================================
--- trunk/seam-gen/view/useradmin/home.xhtml (rev 0)
+++ trunk/seam-gen/view/useradmin/home.xhtml 2009-03-19 04:23:03 UTC (rev 10187)
@@ -0,0 +1,24 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:s="http://jboss.com/products/seam/taglib"
+ template="/layout/template.xhtml">
+
+ <ui:define name="head">
+ <link href="../stylesheet/useradmin.css" rel="stylesheet" type="text/css"/>
+ </ui:define>
+
+ <ui:define name="body">
+
+ <h1>Identity Management</h1>
+
+ <s:button id="manageUsers" view="/useradmin/usermanager.xhtml" styleClass="manageusers" value="Manage Users"/>
+ <br/>
+ <s:button id="manageRoles" view="/useradmin/rolemanager.xhtml" styleClass="manageroles" value="Manage Roles"/>
+
+ </ui:define>
+
+</ui:composition>
Added: trunk/seam-gen/view/useradmin/roledetail.page.xml
===================================================================
--- trunk/seam-gen/view/useradmin/roledetail.page.xml (rev 0)
+++ trunk/seam-gen/view/useradmin/roledetail.page.xml 2009-03-19 04:23:03 UTC (rev 10187)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<page xmlns="http://jboss.com/products/seam/pages"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://jboss.com/products/seam/pages
+ http://jboss.com/products/seam/pages-2.1.xsd"
+ login-required="true">
+
+ <navigation from-action="#{roleAction.save}">
+ <rule if-outcome="success">
+ <redirect view-id="/useradmin/rolemanager.xhtml"/>
+ </rule>
+ </navigation>
+
+</page>
Added: trunk/seam-gen/view/useradmin/roledetail.xhtml
===================================================================
--- trunk/seam-gen/view/useradmin/roledetail.xhtml (rev 0)
+++ trunk/seam-gen/view/useradmin/roledetail.xhtml 2009-03-19 04:23:03 UTC (rev 10187)
@@ -0,0 +1,49 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:rich="http://richfaces.org/rich"
+ xmlns:s="http://jboss.com/products/seam/taglib"
+ template="/layout/template.xhtml">
+
+ <ui:define name="head">
+ <link href="../stylesheet/useradmin.css" rel="stylesheet" type="text/css"/>
+ </ui:define>
+
+ <ui:define name="body">
+
+ <h1>Role Details</h1>
+
+ <h:form id="roleForm">
+
+ <rich:panel>
+ <s:decorate id="roleField" template="/layout/edit.xhtml">
+ <ui:define name="label">Role</ui:define>
+ <h:inputText id="role" value="#{roleAction.role}" readonly="#{identityManager.userExists(roleAction.role)}"/>
+ </s:decorate>
+
+ <s:decorate id="groupsField" template="/layout/edit.xhtml">
+ <ui:define name="label">Member of groups</ui:define>
+ <div class="selectMany">
+ <h:selectManyCheckbox id="groups" value="#{roleAction.groups}" layout="pageDirection" styleClass="roles">
+ <s:selectItems value="#{roleAction.assignableRoles}" var="_role" label="#{_role}"/>
+ </h:selectManyCheckbox>
+ </div>
+ </s:decorate>
+
+ <div style="clear: both;"/>
+
+ </rich:panel>
+
+ <div class="actionButtons">
+ <h:commandButton id="save" value="Save" action="#{roleAction.save}"/>
+ <s:button id="cancel" view="/useradmin/rolemanager.xhtml" value="Cancel" propagation="end"/>
+ </div>
+
+ </h:form>
+
+ </ui:define>
+
+</ui:composition>
Added: trunk/seam-gen/view/useradmin/rolemanager.page.xml
===================================================================
--- trunk/seam-gen/view/useradmin/rolemanager.page.xml (rev 0)
+++ trunk/seam-gen/view/useradmin/rolemanager.page.xml 2009-03-19 04:23:03 UTC (rev 10187)
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<page xmlns="http://jboss.com/products/seam/pages"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://jboss.com/products/seam/pages
+ http://jboss.com/products/seam/pages-2.1.xsd"
+ login-required="true">
+
+ <restrict>#{s:hasPermission('seam.role', 'read')}</restrict>
+
+ <action execute="#{roleSearch.loadRoles}"/>
+
+ <navigation from-action="#{roleAction.createRole}">
+ <redirect view-id="/useradmin/roledetail.xhtml"/>
+ </navigation>
+
+ <navigation from-action="#{roleAction.editRole(roleSearch.selectedRole)}">
+ <redirect view-id="/useradmin/roledetail.xhtml"/>
+ </navigation>
+
+</page>
Added: trunk/seam-gen/view/useradmin/rolemanager.xhtml
===================================================================
--- trunk/seam-gen/view/useradmin/rolemanager.xhtml (rev 0)
+++ trunk/seam-gen/view/useradmin/rolemanager.xhtml 2009-03-19 04:23:03 UTC (rev 10187)
@@ -0,0 +1,62 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:s="http://jboss.com/products/seam/taglib"
+ xmlns:rich="http://richfaces.org/rich"
+ template="/layout/template.xhtml">
+
+ <ui:define name="head">
+ <link href="../stylesheet/useradmin.css" rel="stylesheet" type="text/css"/>
+ <script type="text/javascript">
+function confirmDelete()
+{
+ return confirm("Are you sure you wish to delete this role? This action cannot be undone.");
+}
+ </script>
+ </ui:define>
+
+ <ui:define name="body">
+
+ <h1>Role Manager</h1>
+
+ <s:button id="newRole" action="#{roleAction.createRole}" styleClass="newrole" rendered="#{s:hasPermission('seam.role', 'create', null)}"/>
+
+ <h:form id="rolesCmdForm" prependId="false">
+ <rich:dataTable id="roles" var="_role" value="#{roles}"
+ styleClass="useradmin" headerClass="header" rowClasses="odd,even" columnClasses=",,action">
+ <h:column id="role">
+ <f:facet name="header">Role</f:facet>
+ #{_role}
+ </h:column>
+ <h:column id="groups">
+ <f:facet name="header">Member of groups</f:facet>
+ #{roleSearch.getRoleGroups(_role)}
+ </h:column>
+ <h:column id="action">
+ <f:facet name="header">Action</f:facet>
+ <ui:remove>
+ <!-- There is incompatibility between RichFaces 3.3.0.GA and the version of JSF that ships with JBoss AS 4.2 and GlassFish V2 that
+ prevents UICommand components in a RichFaces dataTable from firing on the first attempt. If you have upgraded to JSF >= 1.2_12
+ you can use the h:commandLink components instead of the s:link compoennts
+ -->
+ <s:fragment rendered="#{s:hasPermission('seam.role', 'update')}">
+ <h:commandLink id="edit" value="Edit" action="#{roleAction.editRole(roleSearch.selectedRole)}"/><span> | </span>
+ </s:fragment>
+ <h:commandLink id="delete" value="Delete" action="#{identityManager.deleteRole(roleSearch.selectedRole)}"
+ rendered="#{s:hasPermission('seam.role', 'delete')}" onclick="return confirmDelete()"/>
+ </ui:remove>
+ <s:fragment rendered="#{s:hasPermission('seam.role', 'update')}">
+ <s:link id="edit" value="Edit" action="#{roleAction.editRole(roleSearch.selectedRole)}"/><span> | </span>
+ </s:fragment>
+ <s:link id="delete" value="Delete" action="#{identityManager.deleteRole(roleSearch.selectedRole)}"
+ rendered="#{s:hasPermission('seam.role', 'delete')}" onclick="return confirmDelete()"/>
+ </h:column>
+ </rich:dataTable>
+ </h:form>
+
+ </ui:define>
+
+</ui:composition>
Added: trunk/seam-gen/view/useradmin/userdetail.page.xml
===================================================================
--- trunk/seam-gen/view/useradmin/userdetail.page.xml (rev 0)
+++ trunk/seam-gen/view/useradmin/userdetail.page.xml 2009-03-19 04:23:03 UTC (rev 10187)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<page xmlns="http://jboss.com/products/seam/pages"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://jboss.com/products/seam/pages
+ http://jboss.com/products/seam/pages-2.1.xsd"
+ login-required="true">
+
+ <navigation from-action="#{userAction.save}">
+ <rule if-outcome="success">
+ <redirect view-id="/useradmin/usermanager.xhtml"/>
+ </rule>
+ </navigation>
+
+</page>
Added: trunk/seam-gen/view/useradmin/userdetail.xhtml
===================================================================
--- trunk/seam-gen/view/useradmin/userdetail.xhtml (rev 0)
+++ trunk/seam-gen/view/useradmin/userdetail.xhtml 2009-03-19 04:23:03 UTC (rev 10187)
@@ -0,0 +1,76 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:rich="http://richfaces.org/rich"
+ xmlns:s="http://jboss.com/products/seam/taglib"
+ template="/layout/template.xhtml">
+
+ <ui:define name="head">
+ <link href="../stylesheet/useradmin.css" rel="stylesheet" type="text/css"/>
+ </ui:define>
+
+ <ui:define name="body">
+
+ <h1>User Details</h1>
+
+ <h:form id="userForm">
+
+ <rich:panel styleClass="useradmin">
+ <ui:remove>
+ <s:decorate id="firstnameField" template="/layout/edit.xhtml">
+ <ui:define name="label">First name</ui:define>
+ <h:inputText id="firstname" value="#{userAction.firstname}"/>
+ </s:decorate>
+
+ <s:decorate id="lastnameField" template="/layout/edit.xhtml">
+ <ui:define name="label">Last name</ui:define>
+ <h:inputText id="lastname" value="#{userAction.lastname}"/>
+ </s:decorate>
+ </ui:remove>
+
+ <s:decorate id="usernameField" template="/layout/edit.xhtml">
+ <ui:define name="label">Username</ui:define>
+ <h:inputText id="username" value="#{userAction.username}" readonly="#{identityManager.userExists(userAction.username)}"/>
+ </s:decorate>
+
+ <s:decorate id="passwordField" template="/layout/edit.xhtml">
+ <ui:define name="label">Password</ui:define>
+ <h:inputSecret id="password" value="#{userAction.password}"/>
+ </s:decorate>
+
+ <s:decorate id="confirmField" template="/layout/edit.xhtml">
+ <ui:define name="label">Confirm password</ui:define>
+ <h:inputSecret id="confirm" value="#{userAction.confirm}"/>
+ </s:decorate>
+
+ <s:decorate id="rolesField" template="/layout/edit.xhtml">
+ <ui:define name="label">Member of roles</ui:define>
+ <div class="selectMany">
+ <h:selectManyCheckbox id="roles" value="#{userAction.roles}" layout="pageDirection" styleClass="roles">
+ <s:selectItems value="#{identityManager.listGrantableRoles()}" var="_role" label="#{_role}"/>
+ </h:selectManyCheckbox>
+ </div>
+ </s:decorate>
+
+ <s:decorate id="enabledField" template="/layout/edit.xhtml">
+ <ui:define name="label">Account enabled</ui:define>
+ <h:selectBooleanCheckbox id="enabled" value="#{userAction.enabled}"/>
+ </s:decorate>
+
+ <div style="clear:both"/>
+
+ </rich:panel>
+
+ <div class="actionButtons">
+ <h:commandButton id="save" value="Save" action="#{userAction.save}"/>
+ <s:button id="cancel" view="/useradmin/usermanager.xhtml" value="Cancel" propagation="end"/>
+ </div>
+
+ </h:form>
+
+ </ui:define>
+
+</ui:composition>
Added: trunk/seam-gen/view/useradmin/usermanager.page.xml
===================================================================
--- trunk/seam-gen/view/useradmin/usermanager.page.xml (rev 0)
+++ trunk/seam-gen/view/useradmin/usermanager.page.xml 2009-03-19 04:23:03 UTC (rev 10187)
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<page xmlns="http://jboss.com/products/seam/pages"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://jboss.com/products/seam/pages
+ http://jboss.com/products/seam/pages-2.1.xsd"
+ login-required="true">
+
+ <restrict>#{s:hasPermission('seam.user', 'read')}</restrict>
+
+ <action execute="#{userSearch.loadUsers}"/>
+
+ <navigation from-action="#{userAction.createUser}">
+ <redirect view-id="/useradmin/userdetail.xhtml"/>
+ </navigation>
+
+ <navigation from-action="#{userAction.editUser(userSearch.selectedUser)}">
+ <redirect view-id="/useradmin/userdetail.xhtml"/>
+ </navigation>
+
+</page>
Added: trunk/seam-gen/view/useradmin/usermanager.xhtml
===================================================================
--- trunk/seam-gen/view/useradmin/usermanager.xhtml (rev 0)
+++ trunk/seam-gen/view/useradmin/usermanager.xhtml 2009-03-19 04:23:03 UTC (rev 10187)
@@ -0,0 +1,67 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:s="http://jboss.com/products/seam/taglib"
+ xmlns:rich="http://richfaces.org/rich"
+ template="/layout/template.xhtml">
+
+ <ui:define name="head">
+ <link href="../stylesheet/useradmin.css" rel="stylesheet" type="text/css"/>
+
+ <script type="text/javascript">
+function confirmDelete()
+{
+ return confirm("Are you sure you wish to delete this user? This action cannot be undone.");
+}
+ </script>
+ </ui:define>
+
+ <ui:define name="body">
+
+ <h1>User Manager</h1>
+
+ <s:button id="newUser" action="#{userAction.createUser}" styleClass="newuser" rendered="#{s:hasPermission('seam.user', 'create')}"/>
+
+ <h:form id="usersCmdForm" prependId="false">
+ <rich:dataTable id="users" var="_user" value="#{users}"
+ styleClass="useradmin" headerClass="header" rowClasses="odd,even" columnClasses=",,enabled,action">
+ <h:column id="username">
+ <f:facet name="header">Username</f:facet>
+ #{_user}
+ </h:column>
+ <h:column id="roles">
+ <f:facet name="header">Member of roles</f:facet>
+ #{userSearch.getUserRoles(_user)}
+ </h:column>
+ <h:column id="enabled">
+ <f:facet name="header">Enabled</f:facet>
+ <div class="status-#{identityManager.isUserEnabled(_user)}"/>
+ </h:column>
+ <h:column id="action">
+ <f:facet name="header">Action</f:facet>
+ <ui:remove>
+ <!-- There is incompatibility between RichFaces 3.3.0.GA and the version of JSF that ships with JBoss AS 4.2 and GlassFish V2 that
+ prevents UICommand components in a RichFaces dataTable from firing on the first attempt. If you have upgraded to JSF >= 1.2_12
+ you can use the h:commandLink components instead of the s:link compoennts
+ -->
+ <s:fragment rendered="#{s:hasPermission('seam.user', 'update')}">
+ <h:commandLink id="edit" value="Edit" action="#{userAction.editUser(userSearch.selectedUser)}"/><span> | </span>
+ </s:fragment>
+ <h:commandLink id="delete" value="Delete" action="#{identityManager.deleteUser(userSearch.selectedUser)}"
+ rendered="#{s:hasPermission('seam.user', 'delete')}" onclick="return confirmDelete()"/>
+ </ui:remove>
+ <s:fragment rendered="#{s:hasPermission('seam.user', 'update')}">
+ <s:link id="edit" value="Edit" action="#{userAction.editUser(userSearch.selectedUser)}"/><span> | </span>
+ </s:fragment>
+ <s:link id="delete" value="Delete" action="#{identityManager.deleteUser(userSearch.selectedUser)}"
+ rendered="#{s:hasPermission('seam.user', 'delete')}" onclick="return confirmDelete()"/>
+ </h:column>
+ </rich:dataTable>
+ </h:form>
+
+ </ui:define>
+
+</ui:composition>
More information about the seam-commits
mailing list