Author: shane.bryzak(a)jboss.com
Date: 2010-07-22 21:24:13 -0400 (Thu, 22 Jul 2010)
New Revision: 13481
Added:
modules/security/trunk/examples/idmconsole/src/main/java/org/jboss/seam/security/examples/idmconsole/converter/
modules/security/trunk/examples/idmconsole/src/main/java/org/jboss/seam/security/examples/idmconsole/converter/GroupConverter.java
modules/security/trunk/examples/idmconsole/src/main/java/org/jboss/seam/security/examples/idmconsole/converter/RoleTypeConverter.java
Modified:
modules/security/trunk/examples/idmconsole/src/main/webapp/roledetail.xhtml
modules/security/trunk/examples/idmconsole/src/main/webapp/userdetail.xhtml
modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/action/GroupSearch.java
modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/action/UserAction.java
Log:
created user role detail view
Added:
modules/security/trunk/examples/idmconsole/src/main/java/org/jboss/seam/security/examples/idmconsole/converter/GroupConverter.java
===================================================================
---
modules/security/trunk/examples/idmconsole/src/main/java/org/jboss/seam/security/examples/idmconsole/converter/GroupConverter.java
(rev 0)
+++
modules/security/trunk/examples/idmconsole/src/main/java/org/jboss/seam/security/examples/idmconsole/converter/GroupConverter.java 2010-07-23
01:24:13 UTC (rev 13481)
@@ -0,0 +1,27 @@
+package org.jboss.seam.security.examples.idmconsole.converter;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+import javax.faces.convert.FacesConverter;
+
+import org.picketlink.idm.api.Group;
+import org.picketlink.idm.impl.api.model.SimpleGroup;
+
+@FacesConverter("groupConverter")
+public class GroupConverter implements Converter
+{
+
+ @Override
+ public Object getAsObject(FacesContext arg0, UIComponent arg1, String arg2)
+ {
+ return new SimpleGroup(arg2, "GROUP");
+ }
+
+ @Override
+ public String getAsString(FacesContext arg0, UIComponent arg1, Object arg2)
+ {
+ return ((Group) arg2).getName();
+ }
+
+}
Added:
modules/security/trunk/examples/idmconsole/src/main/java/org/jboss/seam/security/examples/idmconsole/converter/RoleTypeConverter.java
===================================================================
---
modules/security/trunk/examples/idmconsole/src/main/java/org/jboss/seam/security/examples/idmconsole/converter/RoleTypeConverter.java
(rev 0)
+++
modules/security/trunk/examples/idmconsole/src/main/java/org/jboss/seam/security/examples/idmconsole/converter/RoleTypeConverter.java 2010-07-23
01:24:13 UTC (rev 13481)
@@ -0,0 +1,25 @@
+package org.jboss.seam.security.examples.idmconsole.converter;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+import javax.faces.convert.FacesConverter;
+
+import org.picketlink.idm.api.RoleType;
+import org.picketlink.idm.impl.api.model.SimpleRoleType;
+
+@FacesConverter("roleTypeConverter")
+public class RoleTypeConverter implements Converter
+{
+ @Override
+ public Object getAsObject(FacesContext arg0, UIComponent arg1, String arg2)
+ {
+ return new SimpleRoleType(arg2);
+ }
+
+ @Override
+ public String getAsString(FacesContext arg0, UIComponent arg1, Object arg2)
+ {
+ return ((RoleType) arg2).getName();
+ }
+}
Modified: modules/security/trunk/examples/idmconsole/src/main/webapp/roledetail.xhtml
===================================================================
--- modules/security/trunk/examples/idmconsole/src/main/webapp/roledetail.xhtml 2010-07-22
20:54:51 UTC (rev 13480)
+++ modules/security/trunk/examples/idmconsole/src/main/webapp/roledetail.xhtml 2010-07-23
01:24:13 UTC (rev 13481)
@@ -21,15 +21,19 @@
<div class="formRow">
<h:outputLabel for="roleType" value="Role type"
styleClass="formLabel"/>
- <h:selectOneMenu value="#{userAction.roleType}">
+ <h:selectOneMenu id="roleType"
value="#{userAction.roleType}">
<f:selectItems value="#{userAction.roleTypes}"
var="roleType" itemLabel="#{roleType.name}"/>
+ <f:converter converterId="roleTypeConverter"/>
</h:selectOneMenu>
<div class="validationError"><h:message
for="roleType"/></div>
</div>
<div class="formRow">
- <h:outputLabel for="roleGroup" value="Role group"
styleClass="formLabel"/>
- <h:inputText id="roleGroup"
value="#{userAction.roleGroupName}"/>
+ <h:outputLabel for="roleGroup" value="Role group"
styleClass="formLabel"/>
+ <h:selectOneMenu id="roleGroup"
value="#{userAction.roleGroup}">
+ <f:selectItems value="#{userAction.roleGroups}"
var="group" itemLabel="#{group.name}"/>
+ <f:converter converterId="groupConverter"/>
+ </h:selectOneMenu>
<div class="validationError"><h:message
for="roleGroup"/></div>
</div>
Modified: modules/security/trunk/examples/idmconsole/src/main/webapp/userdetail.xhtml
===================================================================
--- modules/security/trunk/examples/idmconsole/src/main/webapp/userdetail.xhtml 2010-07-22
20:54:51 UTC (rev 13480)
+++ modules/security/trunk/examples/idmconsole/src/main/webapp/userdetail.xhtml 2010-07-23
01:24:13 UTC (rev 13481)
@@ -56,7 +56,6 @@
<h4>Role Memberships</h4>
<div class="formRow">
- <h:outputLabel value="Member of"
styleClass="formLabel"/>
<ui:repeat value="#{userAction.roles}" var="role">
#{role.roleType.name}<span> in group
</span>#{role.group.name}<br/>
</ui:repeat>
Modified:
modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/action/GroupSearch.java
===================================================================
---
modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/action/GroupSearch.java 2010-07-22
20:54:51 UTC (rev 13480)
+++
modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/action/GroupSearch.java 2010-07-23
01:24:13 UTC (rev 13481)
@@ -10,7 +10,6 @@
import org.picketlink.idm.api.Group;
import org.picketlink.idm.api.IdentitySession;
-import org.picketlink.idm.api.query.GroupQueryBuilder;
import org.picketlink.idm.api.query.QueryException;
import org.picketlink.idm.common.exception.IdentityException;
Modified:
modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/action/UserAction.java
===================================================================
---
modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/action/UserAction.java 2010-07-22
20:54:51 UTC (rev 13480)
+++
modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/action/UserAction.java 2010-07-23
01:24:13 UTC (rev 13481)
@@ -3,9 +3,7 @@
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
import javax.enterprise.context.Conversation;
import javax.enterprise.context.ConversationScoped;
@@ -48,12 +46,11 @@
@Inject IdentitySession identitySession;
@Inject Conversation conversation;
- Map<RoleType, Group> newRoles = new HashMap<RoleType, Group>();
-
Collection<RoleType> roleTypes;
+ Collection<Group> roleGroups;
private RoleType roleType;
- private String roleGroupName;
+ private Group roleGroup;
public void createUser()
{
@@ -86,15 +83,15 @@
public void addRole() throws IdentityException, FeatureNotSupportedException
{
roleTypes = identitySession.getRoleManager().findRoleTypes();
+ roleGroups = identitySession.getPersistenceManager().findGroup("GROUP");
roleType = null;
- roleGroupName = null;
+ roleGroup = null;
}
public String roleSave()
- {
- //Role role = new SimpleRole();
- //roles.add(role);
+ {
+ roles.add(new SimpleRole(roleType, null, roleGroup));
return "success";
}
@@ -275,14 +272,14 @@
this.roleType = roleType;
}
- public String getRoleGroupName()
+ public Group getRoleGroup()
{
- return roleGroupName;
+ return roleGroup;
}
- public void setRoleGroupName(String roleGroupName)
+ public void setRoleGroup(Group roleGroup)
{
- this.roleGroupName = roleGroupName;
+ this.roleGroup = roleGroup;
}
public Collection<RoleType> getRoleTypes()
@@ -290,8 +287,10 @@
return roleTypes;
}
- public void setRoleTypes(Collection<RoleType> roleTypes)
+ public Collection<Group> getRoleGroups()
{
- this.roleTypes = roleTypes;
+ return roleGroups;
}
+
+
}
\ No newline at end of file
Show replies by date