[seam-commits] Seam SVN: r13482 - modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/action.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Fri Jul 23 01:15:33 EDT 2010
Author: shane.bryzak at jboss.com
Date: 2010-07-23 01:15:33 -0400 (Fri, 23 Jul 2010)
New Revision: 13482
Modified:
modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/action/UserAction.java
Log:
role management
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-23 01:24:13 UTC (rev 13481)
+++ modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/action/UserAction.java 2010-07-23 05:15:33 UTC (rev 13482)
@@ -27,7 +27,7 @@
*
* @author Shane Bryzak
*/
-public @Transactional @Named @ConversationScoped class UserAction implements Serializable
+public @Named @ConversationScoped class UserAction implements Serializable
{
private static final long serialVersionUID = 5820385095080724087L;
@@ -59,7 +59,7 @@
newUserFlag = true;
}
- public void editUser(String username) throws IdentityException, FeatureNotSupportedException
+ public @Transactional void editUser(String username) throws IdentityException, FeatureNotSupportedException
{
conversation.begin();
this.username = username;
@@ -100,7 +100,7 @@
identitySession.getPersistenceManager().removeUser(new UserImpl(username), true);
}
- public String save() throws IdentityException, FeatureNotSupportedException
+ public @Transactional String save() throws IdentityException, FeatureNotSupportedException
{
if (newUserFlag)
{
@@ -117,7 +117,7 @@
conversation.end();
}
- private String saveNewUser() throws IdentityException
+ private String saveNewUser() throws IdentityException, FeatureNotSupportedException
{
if (password == null || !password.equals(confirm))
{
@@ -128,6 +128,11 @@
User user = identitySession.getPersistenceManager().createUser(username);
identitySession.getAttributesManager().updatePassword(user, password);
+
+ for (Role role : roles)
+ {
+ identitySession.getRoleManager().createRole(role.getRoleType(), user, role.getGroup());
+ }
conversation.end();
@@ -171,11 +176,13 @@
}
}
+ User user = identitySession.getPersistenceManager().findUser(username);
+
for (Role role : roles)
{
if (grantedRoles == null || !grantedRoles.contains(role))
{
- identitySession.getRoleManager().createRole(role.getRoleType(), role.getUser(), role.getGroup());
+ identitySession.getRoleManager().createRole(role.getRoleType(), user, role.getGroup());
}
}
More information about the seam-commits
mailing list