Author: bdaw
Date: 2009-03-18 16:22:52 -0400 (Wed, 18 Mar 2009)
New Revision: 379
Added:
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/RoleManagerTest.java
Modified:
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RoleManager.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AbstractManager.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RoleManagerImpl.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/cache/IdentityStoreCacheSupport.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/repository/FallbackIdentityStoreRepository.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreImpl.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/store/ldap/LDAPIdentityStoreImpl.java
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/APITestCase.java
idm/trunk/idm/src/test/resources/organization-test-config.xml
Log:
- More and more test cases and bug fixes
Modified:
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AbstractManager.java
===================================================================
---
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AbstractManager.java 2009-03-18
15:20:34 UTC (rev 378)
+++
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AbstractManager.java 2009-03-18
20:22:52 UTC (rev 379)
@@ -259,5 +259,13 @@
}
}
+ protected void checkNotNullArgument(Object arg, String name)
+ {
+ if (arg == null)
+ {
+ throw new IllegalArgumentException(name + " cannot be null");
+ }
+ }
+
}
Modified:
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RoleManagerImpl.java
===================================================================
---
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RoleManagerImpl.java 2009-03-18
15:20:34 UTC (rev 378)
+++
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RoleManagerImpl.java 2009-03-18
20:22:52 UTC (rev 379)
@@ -341,7 +341,7 @@
Collection<IdentityObject> ios = null;
- ios = getRepository().findIdentityObject(getInvocationContext(),
createIdentityObject(identity), null, true, convertSearchControls(controls));
+ ios = getRepository().findIdentityObject(getInvocationContext(),
createIdentityObject(identity), ROLE, true, convertSearchControls(controls));
for (IdentityObject io : ios)
{
@@ -367,7 +367,7 @@
Collection<IdentityObject> ios = null;
- ios = getRepository().findIdentityObject(getInvocationContext(),
createIdentityObject(identity), null, true, convertSearchControls(controls));
+ ios = getRepository().findIdentityObject(getInvocationContext(),
createIdentityObject(identity), ROLE, true, convertSearchControls(controls));
for (IdentityObject io : ios)
{
@@ -416,5 +416,8 @@
}
-
+ public <T extends IdentityType> Collection<Role> findRoles(String id,
String roleTypeName) throws IdentityException
+ {
+ return findRoles(createIdentityTypeFromId(id), new SimpleRoleType(roleTypeName));
+ }
}
Modified:
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/cache/IdentityStoreCacheSupport.java
===================================================================
---
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/cache/IdentityStoreCacheSupport.java 2009-03-18
15:20:34 UTC (rev 378)
+++
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/cache/IdentityStoreCacheSupport.java 2009-03-18
20:22:52 UTC (rev 379)
@@ -175,7 +175,7 @@
private Fqn createIOSearchNodeFQN(IdentityObject io, IdentityObjectRelationshipType
relationshipType, boolean parent, Object searchId)
{
- return Fqn.fromElements(OBJECT_TYPES_SEARCH_NODE, io.getIdentityType().getName(),
relationshipType.getName(),
+ return Fqn.fromElements(OBJECT_TYPES_SEARCH_NODE, io.getIdentityType().getName(),
relationshipType == null ? "null" : relationshipType.getName(),
io.getName() + "_" + parent, searchId);
}
Modified:
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/repository/FallbackIdentityStoreRepository.java
===================================================================
---
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/repository/FallbackIdentityStoreRepository.java 2009-03-18
15:20:34 UTC (rev 378)
+++
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/repository/FallbackIdentityStoreRepository.java 2009-03-18
20:22:52 UTC (rev 379)
@@ -45,6 +45,7 @@
import org.jboss.identity.idm.impl.store.SimpleIdentityStoreInvocationContext;
import org.jboss.identity.idm.impl.api.PageSearchControl;
import org.jboss.identity.idm.impl.api.SortByNameSearchControl;
+import org.jboss.identity.idm.impl.api.session.managers.RoleManagerImpl;
import java.util.Map;
import java.util.Collection;
@@ -438,8 +439,14 @@
return defaultIdentityStore.findIdentityObject(defaultCtx, identity,
relationshipType, parent, controls);
}
- Collection<IdentityObject> results =
mappedStore.findIdentityObject(mappedCtx, identity, relationshipType, parent, controls);
+ Collection<IdentityObject> results = new LinkedList<IdentityObject>();
+ if (!RoleManagerImpl.ROLE.getName().equals(relationshipType.getName()) ||
+ mappedStore.getSupportedFeatures().isNamedRelationshipsSupported())
+ {
+ results = mappedStore.findIdentityObject(mappedCtx, identity, relationshipType,
parent, controls);
+ }
+
IdentityObject defaultStoreIdentityObject = null;
try
@@ -606,7 +613,9 @@
IdentityStoreInvocationContext defaultTargetCtx =
resolveInvocationContext(defaultIdentityStore, invocationCxt);
- if (fromStore == toStore)
+ if (fromStore == toStore &&
+ (!RoleManagerImpl.ROLE.getName().equals(relationshipType.getName()) ||
+ fromStore.getSupportedFeatures().isNamedRelationshipsSupported()))
{
return fromStore.resolveRelationships(toTargetCtx, fromIdentity, toIdentity,
relationshipType);
Modified:
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreImpl.java
===================================================================
---
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreImpl.java 2009-03-18
15:20:34 UTC (rev 378)
+++
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreImpl.java 2009-03-18
20:22:52 UTC (rev 379)
@@ -769,14 +769,14 @@
StringBuilder hqlString = new StringBuilder("");
- if (orderByName)
- {
- hqlString.append(" orderBy ior.toIdentityObject.name");
- if (ascending)
- {
- hqlString.append(" asc");
- }
- }
+// if (orderByName)
+// {
+// hqlString.append(" orderBy ior.toIdentityObject.name");
+// if (ascending)
+// {
+// hqlString.append(" asc");
+// }
+// }
if (parent)
{
@@ -784,12 +784,12 @@
if (relationshipType != null)
{
- hqlString.append("select ior.toIdentityObject from
HibernateIdentityObjectRelationship ior where " +
+ hqlString.append("select distinct ior.toIdentityObject from
HibernateIdentityObjectRelationship ior where " +
"ior.toIdentityObject.name like :nameFilter and ior.type.name like
:relType and ior.fromIdentityObject like :identity");
}
else
{
- hqlString.append("select ior.toIdentityObject from
HibernateIdentityObjectRelationship ior where " +
+ hqlString.append("select distinct ior.toIdentityObject from
HibernateIdentityObjectRelationship ior where " +
"ior.toIdentityObject.name like :nameFilter and
ior.fromIdentityObject like :identity");
}
if (orderByName)
@@ -805,12 +805,12 @@
{
if (relationshipType != null)
{
- hqlString.append("select ior.fromIdentityObject from
HibernateIdentityObjectRelationship ior where " +
+ hqlString.append("select distinct ior.fromIdentityObject from
HibernateIdentityObjectRelationship ior where " +
"ior.fromIdentityObject.name like :nameFilter and ior.type.name
like :relType and ior.toIdentityObject like :identity");
}
else
{
- hqlString.append("select ior.fromIdentityObject from
HibernateIdentityObjectRelationship ior where " +
+ hqlString.append("select distinct ior.fromIdentityObject from
HibernateIdentityObjectRelationship ior where " +
"ior.fromIdentityObject.name like :nameFilter and
ior.toIdentityObject like :identity");
}
Modified:
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/store/ldap/LDAPIdentityStoreImpl.java
===================================================================
---
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/store/ldap/LDAPIdentityStoreImpl.java 2009-03-18
15:20:34 UTC (rev 378)
+++
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/store/ldap/LDAPIdentityStoreImpl.java 2009-03-18
20:22:52 UTC (rev 379)
@@ -784,6 +784,12 @@
// If parent simply look for all its members
if (parent)
{
+ if (typeConfig.getMembershipAttributeName() == null)
+ {
+ throw new IdentityException("Membership attribute name not
configured. Given IdentityObjectType cannot have" +
+ "members: " + identity.getIdentityType().getName());
+ }
+
Attributes attrs = ldapContext.getAttributes(ldapFromIO.getDn());
Attribute member = attrs.get(typeConfig.getMembershipAttributeName());
Modified: idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/APITestCase.java
===================================================================
---
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/APITestCase.java 2009-03-18
15:20:34 UTC (rev 378)
+++
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/APITestCase.java 2009-03-18
20:22:52 UTC (rev 379)
@@ -49,11 +49,14 @@
RelationshipManagerTest relationshipManagerTest;
+ RoleManagerTest roleManagerTest;
+
protected void setUp() throws Exception
{
super.setUp();
persistenceManagerTest = new PersistenceManagerTest(this);
relationshipManagerTest = new RelationshipManagerTest(this);
+ roleManagerTest = new RoleManagerTest(this);
}
protected void tearDown() throws Exception
@@ -61,15 +64,53 @@
super.tearDown();
}
- public void testDBPersistenceManager() throws Exception
- {
- identitySessionFactory = new IdentityConfigurationImpl().
- configure(new
File("src/test/resources/organization-test-config.xml")).buildIdentitySessionFactory();
+// public void testDBPersistenceManager() throws Exception
+// {
+// identitySessionFactory = new IdentityConfigurationImpl().
+// configure(new
File("src/test/resources/organization-test-config.xml")).buildIdentitySessionFactory();
+//
+// persistenceManagerTest.testMethods("realm://RedHat/DB");
+// }
+//
+// public void testLDAPMixedPersistenceManager() throws Exception
+// {
+// populateClean();
+//
+// identitySessionFactory = new IdentityConfigurationImpl().
+// configure(new
File("src/test/resources/organization-test-config.xml")).buildIdentitySessionFactory();
+//
+//
+// persistenceManagerTest.testMethods("realm://RedHat/DB_LDAP");
+// }
+//
+// public void testDBRelationshipManager() throws Exception
+// {
+// identitySessionFactory = new IdentityConfigurationImpl().
+// configure(new
File("src/test/resources/organization-test-config.xml")).buildIdentitySessionFactory();
+//
+// relationshipManagerTest.testMethods("realm://RedHat/DB");
+// }
+//
+// public void testLDAPMixedRelationshipManager() throws Exception
+// {
+// populateClean();
+//
+// identitySessionFactory = new IdentityConfigurationImpl().
+// configure(new
File("src/test/resources/organization-test-config.xml")).buildIdentitySessionFactory();
+//
+//
+// relationshipManagerTest.testMethods("realm://RedHat/DB_LDAP");
+// }
+//
+// public void testDBRoleManager() throws Exception
+// {
+// identitySessionFactory = new IdentityConfigurationImpl().
+// configure(new
File("src/test/resources/organization-test-config.xml")).buildIdentitySessionFactory();
+//
+// roleManagerTest.testMethods("realm://RedHat/DB");
+// }
- persistenceManagerTest.testMethods("realm://RedHat/DB");
- }
-
- public void testLDAPMixedPersistenceManager() throws Exception
+ public void testLDAPMixedRoleManager() throws Exception
{
populateClean();
@@ -77,27 +118,8 @@
configure(new
File("src/test/resources/organization-test-config.xml")).buildIdentitySessionFactory();
- persistenceManagerTest.testMethods("realm://RedHat/DB_LDAP");
+ roleManagerTest.testMethods("realm://RedHat/DB_LDAP");
}
- public void testDBRelationshipManager() throws Exception
- {
- identitySessionFactory = new IdentityConfigurationImpl().
- configure(new
File("src/test/resources/organization-test-config.xml")).buildIdentitySessionFactory();
-
- relationshipManagerTest.testMethods("realm://RedHat/DB");
- }
-
- public void testLDAPMixedRelationshipManager() throws Exception
- {
- populateClean();
-
- identitySessionFactory = new IdentityConfigurationImpl().
- configure(new
File("src/test/resources/organization-test-config.xml")).buildIdentitySessionFactory();
-
-
- relationshipManagerTest.testMethods("realm://RedHat/DB_LDAP");
- }
-
}
Copied: idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/RoleManagerTest.java
(from rev 378,
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/RelationshipManagerTest.java)
===================================================================
--- idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/RoleManagerTest.java
(rev 0)
+++
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/RoleManagerTest.java 2009-03-18
20:22:52 UTC (rev 379)
@@ -0,0 +1,234 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+
+package org.jboss.identity.idm.impl.api;
+
+import org.jboss.identity.idm.api.IdentitySession;
+import org.jboss.identity.idm.api.Group;
+import org.jboss.identity.idm.api.User;
+import org.jboss.identity.idm.api.RoleType;
+import org.jboss.identity.idm.api.IdentitySessionFactory;
+import org.jboss.identity.idm.api.Attribute;
+import org.jboss.identity.idm.api.AttributeDescription;
+import org.jboss.identity.idm.api.IdentitySearchControl;
+import org.jboss.identity.idm.api.RoleManager;
+import org.jboss.identity.idm.api.Role;
+import org.jboss.identity.idm.p3p.P3PConstants;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.Random;
+import java.util.Arrays;
+import java.util.LinkedList;
+
+import junit.framework.Assert;
+
+/**
+ *
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw
Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class RoleManagerTest extends Assert
+{
+ //TODO:
+ //TODO: - exception handling
+ //TODO: - search controls
+ //TODO: - features description
+
+ APITestContext ctx;
+
+ private String ORGANIZATION = "ORGANIZATION";
+ private String ORGANIZATION_UNIT = "ORGANIZATION_UNIT";
+ private String DIVISION = "DIVISION";
+ private String DEPARTMENT = "DEPARTMENT";
+ private String PROJECT = "PROJECT";
+ private String PEOPLE = "PEOPLE";
+
+ public RoleManagerTest(APITestContext ctx)
+ {
+ this.ctx = ctx;
+ }
+
+ public void setCtx(APITestContext ctx)
+ {
+ this.ctx = ctx;
+ }
+
+ public APITestContext getCtx()
+ {
+ return ctx;
+ }
+
+ public void testMethods(String realmName) throws Exception
+ {
+ IdentitySessionFactory factory = ctx.getIdentitySessionFactory();
+
+ IdentitySession session = factory.createIdentitySession(realmName);
+
+ session.getTransaction().start();
+
+
+
+ // RoleTypes - pure
+ assertEquals(0, session.getRoleManager().findRoleTypes(null).size());
+
+ // Create / remove
+ RoleType rt1 = session.getRoleManager().createRoleType("rt1");
+ RoleType rt2 = session.getRoleManager().createRoleType("rt2");
+ RoleType rt3 = session.getRoleManager().createRoleType("rt3");
+ RoleType rt4 = session.getRoleManager().createRoleType("rt4");
+
+ assertEquals(4, session.getRoleManager().findRoleTypes(null).size());
+
+ session.getRoleManager().removeRoleType(rt1);
+ session.getRoleManager().removeRoleType(rt2);
+
+ assertEquals(2, session.getRoleManager().findRoleTypes(null).size());
+
+ session.getRoleManager().removeRoleType("rt3");
+ session.getRoleManager().removeRoleType("rt4");
+
+ assertEquals(0, session.getRoleManager().findRoleTypes(null).size());
+
+ // Create all entities for tests
+
+ User user1 = session.getPersistenceManager().createUser("user1");
+ User user2 = session.getPersistenceManager().createUser("user2");
+ User user3 = session.getPersistenceManager().createUser("user3");
+ User user4 = session.getPersistenceManager().createUser("user4");
+
+ Group group1 = session.getPersistenceManager().createGroup("group1",
ORGANIZATION);
+ Group group2 = session.getPersistenceManager().createGroup("group2",
ORGANIZATION_UNIT);
+ Group group3 = session.getPersistenceManager().createGroup("group3",
ORGANIZATION_UNIT);
+ Group group4 = session.getPersistenceManager().createGroup("group4",
DEPARTMENT);
+ Group group5 = session.getPersistenceManager().createGroup("group5",
DEPARTMENT);
+
+ rt1 = session.getRoleManager().createRoleType("rt1");
+ rt2 = session.getRoleManager().createRoleType("rt2");
+ rt3 = session.getRoleManager().createRoleType("rt3");
+ rt4 = session.getRoleManager().createRoleType("rt4");
+
+ assertEquals(4, session.getRoleManager().findRoleTypes(null).size());
+
+ // Create/remove and find roles
+
+ Role role1 = session.getRoleManager().createRole(rt1, user1, group1);
+ Role role2 = session.getRoleManager().createRole(rt1, user1, group2);
+ Role role3 = session.getRoleManager().createRole("rt2", user1.getName(),
group1.getId());
+
+ //
+
+ assertEquals(2, session.getRoleManager().findRoles(user1, rt1).size());
+ assertEquals(1, session.getRoleManager().findRoles(user1, rt2).size());
+ assertEquals(1, session.getRoleManager().findRoles(group1, rt1).size());
+ assertEquals(1, session.getRoleManager().findRoles(group1, rt2).size());
+
+ //
+
+ assertEquals(2, session.getRoleManager().findGroupRoleTypes(group1).size());
+ assertEquals(1, session.getRoleManager().findGroupRoleTypes(group2.getId(),
null).size());
+
+ //
+
+ assertEquals(2, session.getRoleManager().findRoles(user1, rt1).size());
+ assertEquals(1, session.getRoleManager().findRoles(user1.getName(),
"rt2").size());
+ assertEquals(1, session.getRoleManager().findRoles(group1.getId(),
"rt1").size());
+ assertEquals(1, session.getRoleManager().findRoles(group1, rt1).size());
+
+ //
+
+ assertEquals(2, session.getRoleManager().findGroupsWithRelatedRole(user1,
null).size());
+ assertEquals(1, session.getRoleManager().findGroupsWithRelatedRole(user1.getName(),
ORGANIZATION, null).size());
+
+ //
+
+ assertEquals(2, session.getRoleManager().findRoleTypes(user1, group1).size());
+ assertEquals(1, session.getRoleManager().findRoleTypes(user1.getName(),
group2.getId(), null).size());
+
+ //
+
+ assertEquals(2, session.getRoleManager().findUserRoleTypes(user1).size());
+ assertEquals(0, session.getRoleManager().findUserRoleTypes(user2.getName(),
null).size());
+
+ //
+ assertTrue(session.getRoleManager().hasRole(user1, group1, rt1));
+ assertTrue(session.getRoleManager().hasRole(user1, group1, rt2));
+ assertTrue(session.getRoleManager().hasRole("user1", group2.getId(),
"rt1"));
+ assertFalse(session.getRoleManager().hasRole("user2", group2.getId(),
"rt1"));
+ assertFalse(session.getRoleManager().hasRole(user1, group1, rt3));
+ assertFalse(session.getRoleManager().hasRole(user1, group4, rt3));
+
+
+ // Remove roles
+
+ session.getRoleManager().removeRole(rt1, user1, group1);
+ session.getRoleManager().removeRole(role2);
+ session.getRoleManager().removeRole("rt2", user1.getName(),
group1.getId());
+
+ assertFalse(session.getRoleManager().hasRole(user1, group1, rt1));
+ assertFalse(session.getRoleManager().hasRole(user1, group1, rt2));
+ assertFalse(session.getRoleManager().hasRole("user1", group2.getId(),
"rt1"));
+
+ //
+
+ assertEquals(0, session.getRoleManager().findRoles(user1, rt1).size());
+ assertEquals(0, session.getRoleManager().findRoles(user1, rt2).size());
+ assertEquals(0, session.getRoleManager().findRoles(group1, rt1).size());
+ assertEquals(0, session.getRoleManager().findRoles(group1, rt2).size());
+
+ //
+
+ assertEquals(0, session.getRoleManager().findGroupRoleTypes(group1).size());
+ assertEquals(0, session.getRoleManager().findGroupRoleTypes(group2.getId(),
null).size());
+
+ //
+
+ assertEquals(0, session.getRoleManager().findRoles(user1, rt1).size());
+ assertEquals(0, session.getRoleManager().findRoles(user1.getName(),
"rt2").size());
+ assertEquals(0, session.getRoleManager().findRoles(group1.getId(),
"rt1").size());
+ assertEquals(0, session.getRoleManager().findRoles(group1, rt1).size());
+
+ //
+
+ assertEquals(0, session.getRoleManager().findGroupsWithRelatedRole(user1,
null).size());
+ assertEquals(0, session.getRoleManager().findGroupsWithRelatedRole(user1.getName(),
ORGANIZATION, null).size());
+
+ //
+
+ assertEquals(0, session.getRoleManager().findRoleTypes(user1, group1).size());
+ assertEquals(0, session.getRoleManager().findRoleTypes(user1.getName(),
group2.getId(), null).size());
+
+ //
+
+ assertEquals(0, session.getRoleManager().findUserRoleTypes(user1).size());
+ assertEquals(0, session.getRoleManager().findUserRoleTypes(user2.getName(),
null).size());
+
+
+
+
+ session.getTransaction().commit();
+
+ }
+
+
+
+}
\ No newline at end of file
Modified: idm/trunk/idm/src/test/resources/organization-test-config.xml
===================================================================
--- idm/trunk/idm/src/test/resources/organization-test-config.xml 2009-03-18 15:20:34 UTC
(rev 378)
+++ idm/trunk/idm/src/test/resources/organization-test-config.xml 2009-03-18 20:22:52 UTC
(rev 379)
@@ -167,6 +167,10 @@
<relationships>
<relationship>
<relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
+
<identity-object-type-ref>ORGANIZATION</identity-object-type-ref>
+ </relationship>
+ <relationship>
+
<relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
<identity-object-type-ref>COMMUNITY</identity-object-type-ref>
</relationship>
<relationship>
Modified: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RoleManager.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RoleManager.java 2009-03-18
15:20:34 UTC (rev 378)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RoleManager.java 2009-03-18
20:22:52 UTC (rev 379)
@@ -288,4 +288,14 @@
<T extends IdentityType> Collection<Role> findRoles(T identityType,
RoleType roleType) throws
IdentityException;
+ /**
+ * Find Role objects with a given RoleType name associated with IdentityType for a
given id (Group) or name (User)
+ * @param id
+ * @param roleTypeName
+ * @return
+ * @throws IdentityException
+ */
+ <T extends IdentityType> Collection<Role> findRoles(String id,
+ String roleTypeName) throws
IdentityException;
+
}