Author: shane.bryzak(a)jboss.com
Date: 2008-10-21 05:52:11 -0400 (Tue, 21 Oct 2008)
New Revision: 9371
Modified:
trunk/src/main/org/jboss/seam/security/management/JpaIdentityStore.java
trunk/src/main/org/jboss/seam/security/management/action/RoleAction.java
Log:
JBSEAM-3552
Modified: trunk/src/main/org/jboss/seam/security/management/JpaIdentityStore.java
===================================================================
--- trunk/src/main/org/jboss/seam/security/management/JpaIdentityStore.java 2008-10-21
09:51:38 UTC (rev 9370)
+++ trunk/src/main/org/jboss/seam/security/management/JpaIdentityStore.java 2008-10-21
09:52:11 UTC (rev 9371)
@@ -422,11 +422,21 @@
if (roleGroups == null)
{
// This should either be a Set, or a List...
- if (Set.class.isAssignableFrom((Class) roleGroupsProperty.getPropertyType()))
+ Class rawType = null;
+ if (roleGroupsProperty.getPropertyType() instanceof ParameterizedType)
{
+ rawType = (Class) ((ParameterizedType)
roleGroupsProperty.getPropertyType()).getRawType();
+ }
+ else
+ {
+ return false;
+ }
+
+ if (Set.class.isAssignableFrom(rawType))
+ {
roleGroups = new HashSet();
}
- else if (List.class.isAssignableFrom((Class)
roleGroupsProperty.getPropertyType()))
+ else if (List.class.isAssignableFrom(rawType))
{
roleGroups = new ArrayList();
}
Modified: trunk/src/main/org/jboss/seam/security/management/action/RoleAction.java
===================================================================
--- trunk/src/main/org/jboss/seam/security/management/action/RoleAction.java 2008-10-21
09:51:38 UTC (rev 9370)
+++ trunk/src/main/org/jboss/seam/security/management/action/RoleAction.java 2008-10-21
09:52:11 UTC (rev 9371)
@@ -20,6 +20,7 @@
@Install(precedence = BUILT_IN)
public class RoleAction implements Serializable
{
+ private String originalRole;
private String role;
private List<String> groups;
@@ -34,12 +35,18 @@
@Begin
public void editRole(String role)
{
+ this.originalRole = role;
this.role = role;
groups = identityManager.getRoleGroups(role);
}
public String save()
{
+ if (role != null && originalRole != null &&
!role.equals(originalRole))
+ {
+ identityManager.deleteRole(originalRole);
+ }
+
if (identityManager.roleExists(role))
{
return saveExistingRole();
@@ -93,6 +100,13 @@
return role;
}
+ public List<String> getAssignableRoles()
+ {
+ List<String> roles = identityManager.listGrantableRoles();
+ roles.remove(role);
+ return roles;
+ }
+
public void setRole(String role)
{
this.role = role;