Author: bdaw
Date: 2009-01-26 09:13:22 -0500 (Mon, 26 Jan 2009)
New Revision: 12633
Modified:
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/auth/SynchronizingLDAPExtLoginModule.java
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/auth/SynchronizingLDAPLoginModule.java
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/auth/SynchronizingLoginModule.java
Log:
JBPORTAL-2261 - fix how defaultAssignedRole was handled
Modified:
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/auth/SynchronizingLDAPExtLoginModule.java
===================================================================
---
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/auth/SynchronizingLDAPExtLoginModule.java 2009-01-26
13:28:11 UTC (rev 12632)
+++
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/auth/SynchronizingLDAPExtLoginModule.java 2009-01-26
14:13:22 UTC (rev 12633)
@@ -178,25 +178,37 @@
protected Group[] getRoleSets() throws LoginException
{
Group[] rolesGroup = super.getRoleSets();
- if (additionalRole != null)
+ try
{
- try
+ for (int i = 0; i < rolesGroup.length; i++)
{
- for (int i = 0; i < rolesGroup.length; i++)
+ Group group = rolesGroup[i];
+ if (group.getName().equals("Roles"))
{
- Group group = rolesGroup[i];
- if (group.getName().equals("Roles"))
+ if (additionalRole != null)
{
- group.addMember(createIdentity(additionalRole));
+ Principal role = createIdentity(additionalRole);
+ if (!group.isMember(role))
+ {
+ group.addMember(role);
+ }
}
+ if (defaultAssignedRole != null)
+ {
+ Principal role = createIdentity(defaultAssignedRole);
+ if (!group.isMember(role))
+ {
+ group.addMember(role);
+ }
+ }
}
}
- catch (Exception e)
- {
- //just a try
- log.error("Error when adding additional role: ", e);
- }
}
+ catch (Exception e)
+ {
+ //just a try
+ log.error("Error when adding additional role: ", e);
+ }
return rolesGroup;
}
Modified:
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/auth/SynchronizingLDAPLoginModule.java
===================================================================
---
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/auth/SynchronizingLDAPLoginModule.java 2009-01-26
13:28:11 UTC (rev 12632)
+++
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/auth/SynchronizingLDAPLoginModule.java 2009-01-26
14:13:22 UTC (rev 12633)
@@ -176,25 +176,40 @@
protected Group[] getRoleSets() throws LoginException
{
Group[] rolesGroup = super.getRoleSets();
- if (additionalRole != null)
+
+ try
{
- try
+ for (int i = 0; i < rolesGroup.length; i++)
{
- for (int i = 0; i < rolesGroup.length; i++)
+ Group group = rolesGroup[i];
+ if (group.getName().equals("Roles"))
{
- Group group = rolesGroup[i];
- if (group.getName().equals("Roles"))
+ if (additionalRole != null)
{
- group.addMember(createIdentity(additionalRole));
+ Principal role = createIdentity(additionalRole);
+ if (!group.isMember(role))
+ {
+ group.addMember(role);
+ }
}
+ if (defaultAssignedRole != null)
+ {
+ Principal role = createIdentity(defaultAssignedRole);
+ if (!group.isMember(role))
+ {
+ group.addMember(role);
+ }
+ }
}
}
- catch (Exception e)
- {
- //just a try
- log.error("Error when adding additional role: ", e);
- }
}
+ catch (Exception e)
+ {
+ //just a try
+ log.error("Error when adding additional role: ", e);
+ }
+
+
return rolesGroup;
}
Modified:
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/auth/SynchronizingLoginModule.java
===================================================================
---
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/auth/SynchronizingLoginModule.java 2009-01-26
13:28:11 UTC (rev 12632)
+++
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/auth/SynchronizingLoginModule.java 2009-01-26
14:13:22 UTC (rev 12633)
@@ -207,6 +207,18 @@
log.error("Error when adding additional role: ", e);
}
}
+ if (defaultAssignedRole != null)
+ {
+ try
+ {
+ userRoles.addMember(createIdentity(defaultAssignedRole));
+ }
+ catch (Exception e)
+ {
+ //just a try
+ log.error("Error when adding additional role: ", e);
+ }
+ }
Group[] roleSets = {userRoles};
return roleSets;
@@ -353,7 +365,6 @@
try
{
rolesToAssign.add(getRoleModule().findRoleByName(defaultAssignedRole));
- userRoles.addMember(createIdentity(defaultAssignedRole));
}
catch(Exception e)
{