Author: bdaw
Date: 2009-03-19 08:54:42 -0400 (Thu, 19 Mar 2009)
New Revision: 382
Modified:
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/PersistenceManager.java
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RelationshipManager.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AttributesManagerImpl.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RelationshipManagerImpl.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/repository/FallbackIdentityStoreRepository.java
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/RelationshipManagerTest.java
idm/trunk/idm/src/test/resources/organization-test-config.xml
Log:
- few more new API methods, test cases and bug fixes...
Modified:
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AttributesManagerImpl.java
===================================================================
---
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AttributesManagerImpl.java 2009-03-18
21:22:32 UTC (rev 381)
+++
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AttributesManagerImpl.java 2009-03-19
12:54:42 UTC (rev 382)
@@ -59,6 +59,9 @@
public AttributeDescription getAttributeDescription(IdentityType identityType, String
name)
{
+ checkNotNullArgument(identityType, "IdentityType");
+ checkNotNullArgument(name, "Attribute name");
+
Map<String, IdentityObjectAttributeMetaData> mdMap =
getRepository().getAttributesMetaData(getInvocationContext(),
createIdentityObject(identityType).getIdentityType());
@@ -81,6 +84,9 @@
public AttributeDescription getAttributeDescription(String id, String attributeName)
{
+ checkNotNullArgument(id, "IdentityType Id");
+ checkNotNullArgument(attributeName, "Attribute name");
+
IdentityType identityType = createIdentityTypeFromId(id);
return getAttributeDescription(identityType, attributeName);
@@ -90,6 +96,8 @@
public Map<String, AttributeDescription>
getSupportedAttributesDescriptions(IdentityType identityType)
{
+ checkNotNullArgument(identityType, "IdentityType");
+
Map<String, IdentityObjectAttributeMetaData> mdMap =
getRepository().getAttributesMetaData(getInvocationContext(),
createIdentityObject(identityType).getIdentityType());
@@ -115,6 +123,8 @@
public Map<String, AttributeDescription>
getSupportedAttributesDescriptions(String id)
{
+ checkNotNullArgument(id, "Id (Group) or name (User)");
+
IdentityType identityType = createIdentityTypeFromId(id);
return getSupportedAttributesDescriptions(identityType);
@@ -122,11 +132,15 @@
public Set<String> getSupportedAttributeNames(IdentityType identityType) throws
IdentityException
{
+ checkNotNullArgument(identityType, "IdentityType");
+
return getRepository().getSupportedAttributeNames(getInvocationContext(),
createIdentityObject(identityType).getIdentityType());
}
public Set<String> getSupportedAttributeNames(String id) throws
IdentityException
{
+ checkNotNullArgument(id, "Id (Group) or name (User)");
+
IdentityType identityType = createIdentityTypeFromId(id);
return getSupportedAttributeNames(identityType);
@@ -134,6 +148,8 @@
public Map<String, Attribute> getAttributes(IdentityType identity) throws
IdentityException
{
+ checkNotNullArgument(identity, "IdentityType");
+
Map<String, IdentityObjectAttribute> map =
getRepository().getAttributes(getInvocationContext(), createIdentityObject(identity));
Map<String, Attribute> newMap = new HashMap<String, Attribute>();
@@ -147,6 +163,10 @@
public Map<String, Attribute> getAttributes(String id) throws IdentityException
{
+
+ checkNotNullArgument(id, "Id (Group) or name (User)");
+
+
IdentityType identityType = createIdentityTypeFromId(id);
return getAttributes(identityType);
@@ -154,12 +174,18 @@
public void updateAttributes(IdentityType identity, Attribute[] attributes) throws
IdentityException
{
+ checkNotNullArgument(identity, "IdentityType");
+ checkNotNullArgument(attributes, "Attributes");
+
getRepository().updateAttributes(getInvocationContext(),
createIdentityObject(identity), convertAttributes(attributes));
}
public void updateAttributes(String id, Attribute[] attributes) throws
IdentityException
{
+ checkNotNullArgument(id, "Id (Group) or name (User)");
+ checkNotNullArgument(attributes, "Attributes");
+
IdentityType identityType = createIdentityTypeFromId(id);
updateAttributes(identityType, attributes);
@@ -168,11 +194,17 @@
public Attribute getAttribute(IdentityType identity, String attributeName) throws
IdentityException
{
+ checkNotNullArgument(identity, "IdentityType");
+ checkNotNullArgument(attributeName, "Attribute name");
+
return getAttributes(identity).get(attributeName);
}
public Attribute getAttribute(String id, String attributeName) throws
IdentityException
{
+ checkNotNullArgument(id, "Id (Group) or name (User)");
+ checkNotNullArgument(attributeName, "Attribute name");
+
IdentityType identityType = createIdentityTypeFromId(id);
return getAttribute(identityType, attributeName);
@@ -180,6 +212,10 @@
public void addAttribute(IdentityType identity, String attributeName, Object[] values)
throws IdentityException
{
+ checkNotNullArgument(identity, "IdentityType");
+ checkNotNullArgument(attributeName, "Attribute name");
+ checkNotNullArgument(values, "Attribute values");
+
Attribute[] attrs = new Attribute[]{new SimpleAttribute(attributeName, values)};
addAttributes(identity, attrs);
@@ -187,6 +223,9 @@
public void addAttributes(String id, Attribute[] attributes) throws IdentityException
{
+ checkNotNullArgument(id, "Id (Group) or name (User)");
+ checkNotNullArgument(attributes, "Attributes");
+
IdentityType identityType = createIdentityTypeFromId(id);
addAttributes(identityType, attributes);
@@ -195,6 +234,10 @@
public void addAttribute(IdentityType identity, String attributeName, Object value)
throws IdentityException
{
+ checkNotNullArgument(identity, "IdentityType");
+ checkNotNullArgument(attributeName, "Attribute name");
+ checkNotNullArgument(value, "Attribute value");
+
Attribute[] attrs = new Attribute[]{new SimpleAttribute(attributeName, value)};
@@ -204,6 +247,10 @@
public void addAttribute(String id, String attributeName, Object[] values) throws
IdentityException
{
+ checkNotNullArgument(id, "Id (Group) or name (User)");
+ checkNotNullArgument(attributeName, "Attribute name");
+ checkNotNullArgument(values, "Attribute values");
+
IdentityType identityType = createIdentityTypeFromId(id);
addAttribute(identityType, attributeName, values);
@@ -212,6 +259,10 @@
public void addAttribute(String id, String attributeName, Object value) throws
IdentityException
{
+ checkNotNullArgument(id, "Id (Group) or name (User)");
+ checkNotNullArgument(attributeName, "Attribute name");
+ checkNotNullArgument(value, "Attribute value");
+
IdentityType identityType = createIdentityTypeFromId(id);
addAttribute(identityType, attributeName, value);
@@ -220,6 +271,8 @@
public void addAttributes(IdentityType identity, Attribute[] attributes) throws
IdentityException
{
+ checkNotNullArgument(identity, "IdentityType");
+ checkNotNullArgument(attributes, "Attributes");
getRepository().addAttributes(getInvocationContext(),
createIdentityObject(identity), convertAttributes(attributes));
}
@@ -227,11 +280,16 @@
public void removeAttributes(IdentityType identity, String[] attributeNames) throws
IdentityException
{
+ checkNotNullArgument(identity, "IdentityType");
+ checkNotNullArgument(attributeNames, "Attribute names");
getRepository().removeAttributes(getInvocationContext(),
createIdentityObject(identity), attributeNames);
}
public void removeAttributes(String id, String[] attributeNames) throws
IdentityException
{
+ checkNotNullArgument(id, "Id (Group) or name (User)");
+ checkNotNullArgument(attributeNames, "Attribute names");
+
IdentityType identityType = createIdentityTypeFromId(id);
removeAttributes(identityType, attributeNames);
@@ -240,26 +298,36 @@
public boolean hasPassword(User identity) throws IdentityException
{
+ checkNotNullArgument(identity, "User");
return
getRepository().getSupportedFeatures().isCredentialSupported(createIdentityObject(identity).getIdentityType(),
PasswordCredential.TYPE);
}
public boolean validatePassword(User identity, String password) throws
IdentityException
{
+ checkNotNullArgument(identity, "User");
+ checkNotNullArgument(password, "Password");
return getRepository().validateCredential(getInvocationContext(),
createIdentityObject(identity), new PasswordCredential(password));
}
public void updatePassword(User identity, String password) throws IdentityException
{
+ checkNotNullArgument(identity, "User");
+ checkNotNullArgument(password, "Password");
getRepository().updateCredential(getInvocationContext(),
createIdentityObject(identity), new PasswordCredential(password));
}
public boolean hasCredential(User identity, CredentialType credentialType) throws
IdentityException
{
+ checkNotNullArgument(identity, "User");
+ checkNotNullArgument(credentialType, "CredentialType");
+
return
getRepository().getSupportedFeatures().isCredentialSupported(createIdentityObject(identity).getIdentityType(),
new SimpleCredentialType(credentialType.getName()));
}
public boolean validateCredentials(User identity, Credential[] credentials) throws
IdentityException
{
+ checkNotNullArgument(identity, "User");
+ checkNotNullArgument(credentials, "Credentials");
for (Credential credential : credentials)
{
@@ -285,6 +353,9 @@
public void updateCredential(User identity, Credential credential) throws
IdentityException
{
+ checkNotNullArgument(identity, "User");
+ checkNotNullArgument(credential, "Credential");
+
if (credential instanceof IdentityObjectCredential)
{
getRepository().updateCredential(getInvocationContext(),
createIdentityObject(identity), (IdentityObjectCredential)credential);
Modified:
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RelationshipManagerImpl.java
===================================================================
---
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RelationshipManagerImpl.java 2009-03-18
21:22:32 UTC (rev 381)
+++
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RelationshipManagerImpl.java 2009-03-19
12:54:42 UTC (rev 382)
@@ -44,6 +44,7 @@
import java.util.LinkedList;
import java.util.Set;
import java.util.HashSet;
+import java.util.Arrays;
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw
Dawidowicz</a>
@@ -170,6 +171,14 @@
}
}
+ public void associateGroups(Group parent, Collection<Group> members) throws
IdentityException
+ {
+ checkNotNullArgument(parent, "parent");
+ checkNotNullArgument(members, "members");
+
+ associateGroups(Arrays.asList(parent), members);
+ }
+
public void associateGroupsByIds(Collection<String> parentIds,
Collection<String> memberIds) throws IdentityException
{
checkNotNullArgument(parentIds, "Parents Ids");
@@ -188,6 +197,13 @@
}
}
+ public void associateGroupsByIds(String parentId, Collection<String> memberIds)
throws IdentityException
+ {
+ checkNotNullArgument(parentId, "Parent Id");
+
+ associateGroupsByIds(Arrays.asList(parentId), memberIds);
+ }
+
public void associateGroups(Group parent, Group member) throws IdentityException
{
checkNotNullArgument(parent, "Parent group");
@@ -223,6 +239,14 @@
}
}
+ public void associateUsers(Group parent, Collection<User> members) throws
IdentityException
+ {
+ checkNotNullArgument(parent, "Parent group");
+
+ associateUsers(Arrays.asList(parent), members);
+
+ }
+
public void associateUsersByIds(Collection<String> parents,
Collection<String> members) throws IdentityException
{
@@ -243,6 +267,14 @@
}
+ public void associateUsersByIds(String parentId, Collection<String> members)
throws IdentityException
+ {
+ checkNotNullArgument(parentId, "Parent Id");
+
+ associateUsersByIds(Arrays.asList(parentId), members);
+
+ }
+
public void associateUsers(Group parent, User member) throws IdentityException
{
checkNotNullArgument(parent, "Parent group");
@@ -279,6 +311,13 @@
}
}
+ public void disassociateGroups(Group parent, Collection<Group> members) throws
IdentityException
+ {
+ checkNotNullArgument(parent, "Parent");
+
+ disassociateGroups(Arrays.asList(parent), members);
+ }
+
public void disassociateGroupsByIds(Collection<String> parents,
Collection<String> members) throws IdentityException
{
checkNotNullArgument(parents, "parents");
@@ -297,6 +336,13 @@
}
}
+ public void disassociateGroupsByIds(String parent, Collection<String> members)
throws IdentityException
+ {
+ checkNotNullArgument(parent, "Parent Id");
+
+ disassociateGroupsByIds(Arrays.asList(parent), members);
+ }
+
public void disassociateUsers(Collection<Group> parents, Collection<User>
members) throws IdentityException
{
checkNotNullArgument(parents, "parents");
@@ -316,6 +362,13 @@
}
+ public void disassociateUsers(Group parent, Collection<User> members) throws
IdentityException
+ {
+ checkNotNullArgument(parent, "Parent group");
+
+ disassociateUsers(Arrays.asList(parent), members);
+ }
+
public void disassociateUsersByIds(Collection<String> parents,
Collection<String> members) throws IdentityException
{
checkNotNullArgument(parents, "parents");
@@ -335,6 +388,14 @@
}
}
+ public void disassociateUsersByIds(String parent, Collection<String> members)
throws IdentityException
+ {
+ checkNotNullArgument(parent, "Parent Id");
+
+ disassociateUsersByIds(Arrays.asList(parent), members);
+
+ }
+
public <G extends IdentityType, I extends IdentityType> boolean
isAssociated(Collection<G> parents, Collection<I> members) throws
IdentityException
{
//TODO: maybe IdentityStore should have isRelationshipPresent method to improve
this?
@@ -420,12 +481,13 @@
public Collection<Group> findAssociatedGroups(Group group, String groupType,
boolean parent, boolean inherited, IdentitySearchControl[] controls) throws
IdentityException
{
+
checkNotNullArgument(group, "Group");
- checkNotNullArgument(groupType, "Group type");
+// checkNotNullArgument(groupType, "Group type");
List<Group> identities = new LinkedList<Group>();
- IdentityObjectType iot = getIdentityObjectType(groupType);
+ IdentityObjectType iot = groupType != null ? getIdentityObjectType(groupType) :
null;
//TODO Handle inherited
if (inherited)
@@ -437,7 +499,7 @@
for (IdentityObject io : ios)
{
- if (io.getIdentityType().getName().equals(iot.getName()))
+ if (iot == null || io.getIdentityType().getName().equals(iot.getName()))
{
identities.add(createGroup(io));
}
@@ -450,7 +512,7 @@
public Collection<Group> findAssociatedGroups(String groupId, String groupType,
boolean parent, boolean inherited, IdentitySearchControl[] controls) throws
IdentityException
{
checkNotNullArgument(groupId, "Group Id");
- checkNotNullArgument(groupType, "Group type");
+// checkNotNullArgument(groupType, "Group type");
Group group = createGroupFromId(groupId);
@@ -460,7 +522,7 @@
public Collection<Group> findAssociatedGroups(Group group, String groupType,
boolean parent, boolean inherited) throws IdentityException
{
checkNotNullArgument(group, "Group");
- checkNotNullArgument(groupType, "Group type");
+// checkNotNullArgument(groupType, "Group type");
return findAssociatedGroups(group, groupType, parent, inherited, null);
}
@@ -468,17 +530,17 @@
public Collection<Group> findAssociatedGroups(User identity, String groupType,
IdentitySearchControl[] controls) throws IdentityException
{
checkNotNullArgument(identity, "User");
- checkNotNullArgument(groupType, "Group type");
+ //checkNotNullArgument(groupType, "Group type");
List<Group> identities = new LinkedList<Group>();
- IdentityObjectType iot = getIdentityObjectType(groupType);
+ IdentityObjectType iot = groupType != null ? getIdentityObjectType(groupType) :
null;
Collection<IdentityObject> ios =
getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(identity),
MEMBER, false, convertSearchControls(controls));
for (IdentityObject io : ios)
{
- if (io.getIdentityType().getName().equals(iot.getName()))
+ if (iot == null || io.getIdentityType().getName().equals(iot.getName()))
{
identities.add(createGroup(io));
}
@@ -490,7 +552,7 @@
public Collection<Group> findAssociatedGroups(String userName, String groupType,
IdentitySearchControl[] controls) throws IdentityException
{
checkNotNullArgument(userName, "User name");
- checkNotNullArgument(groupType, "Group type");
+ //checkNotNullArgument(groupType, "Group type");
User user = createUserFromId(userName);
@@ -500,7 +562,7 @@
public Collection<Group> findAssociatedGroups(User identity, String groupType)
throws IdentityException
{
checkNotNullArgument(identity, "User");
- checkNotNullArgument(groupType, "Group type");
+ //checkNotNullArgument(groupType, "Group type");
return findAssociatedGroups(identity, groupType, null);
}
@@ -513,8 +575,14 @@
Collection<IdentityObject> ios =
getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(identity),
MEMBER, false, convertSearchControls(controls));
+
+ String userTypeName = getUserObjectType().getName();
+
for (IdentityObject io : ios)
{
+
+ // Filter out users
+ if (!io.getIdentityType().getName().equals(userTypeName))
identities.add(createGroup(io));
}
@@ -555,6 +623,7 @@
for (IdentityObject io : ios)
{
+ //Filter out groups
if (io.getIdentityType().getName().equals(userTypeName))
{
identities.add(createUser(io));
@@ -580,5 +649,68 @@
return findAssociatedUsers(group, inherited, null);
}
-
+ public Collection<Group> findRelatedGroups(User user, String groupType,
IdentitySearchControl[] controls) throws IdentityException
+ {
+ checkNotNullArgument(user, "User");
+
+ List<Group> identities = new LinkedList<Group>();
+
+ Collection<IdentityObject> ios =
getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(user),
null, false, convertSearchControls(controls));
+
+
+ String userTypeName = getUserObjectType().getName();
+
+ for (IdentityObject io : ios)
+ {
+ // Filter out users
+ if (!io.getIdentityType().getName().equals(userTypeName))
+ identities.add(createGroup(io));
+ }
+
+ return identities;
+ }
+
+ public Collection<Group> findRelatedGroups(String userName, String groupType,
IdentitySearchControl[] controls) throws IdentityException
+ {
+ checkNotNullArgument(userName, "User name");
+
+ User user = createUserFromId(userName);
+
+ return findRelatedGroups(user, groupType, controls);
+ }
+
+ public Collection<User> findRelatedUsers(Group group, IdentitySearchControl[]
controls) throws IdentityException
+ {
+ checkNotNullArgument(group, "Group");
+
+ List<User> identities = new LinkedList<User>();
+
+ Collection<IdentityObject> ios =
getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(group),
null, true, convertSearchControls(controls));
+
+ String userTypeName = getUserObjectType().getName();
+
+ for (IdentityObject io : ios)
+ {
+ if (io.getIdentityType().getName().equals(userTypeName))
+ {
+ User user = createUser(io);
+
+ if (!identities.contains(user))
+ {
+ identities.add(createUser(io));
+ }
+ }
+ }
+
+ return identities;
+ }
+
+ public Collection<User> findRelatedUsers(String groupId, IdentitySearchControl[]
controls) throws IdentityException
+ {
+ checkNotNullArgument(groupId, "Group Id");
+
+ Group group = createGroupFromId(groupId);
+
+ return findRelatedUsers(group, controls);
+ }
}
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
21:22:32 UTC (rev 381)
+++
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RoleManagerImpl.java 2009-03-19
12:54:42 UTC (rev 382)
@@ -191,10 +191,10 @@
//TODO: add createRoleType switch to the API
- IdentityObjectRelationship rel =
getRepository().createRelationship(getInvocationContext(), createIdentityObject(identity),
createIdentityObject(group), ROLE, roleType.getName(), false);
+ IdentityObjectRelationship rel =
getRepository().createRelationship(getInvocationContext(), createIdentityObject(group),
createIdentityObject(identity), ROLE, roleType.getName(), false);
//TODO: null id - IdentityObjectRelationship doesn't have id
- return new SimpleRole(new SimpleRoleType(rel.getName()),
createUser(rel.getFromIdentityObject()), createGroup(rel.getToIdentityObject()));
+ return new SimpleRole(new SimpleRoleType(rel.getName()),
createUser(rel.getToIdentityObject()), createGroup(rel.getFromIdentityObject()));
}
@@ -216,7 +216,7 @@
checkNotNullArgument(identity, "User");
checkNotNullArgument(group, "Group");
- getRepository().removeRelationship(getInvocationContext(),
createIdentityObject(identity), createIdentityObject(group), ROLE, roleType.getName());
+ getRepository().removeRelationship(getInvocationContext(),
createIdentityObject(group), createIdentityObject(identity), ROLE, roleType.getName());
}
public void removeRole(String roleTypeName, String userName, String groupId) throws
IdentityException
@@ -235,7 +235,7 @@
{
checkNotNullArgument(role, "Role");
- getRepository().removeRelationship(getInvocationContext(),
createIdentityObject(role.getIdentity()), createIdentityObject(role.getGroup()), ROLE,
role.getRoleType().getName());
+ getRepository().removeRelationship(getInvocationContext(),
createIdentityObject(role.getGroup()), createIdentityObject(role.getIdentity()), ROLE,
role.getRoleType().getName());
}
public boolean hasRole(User identity, Group group, RoleType roleType) throws
IdentityException
@@ -246,7 +246,7 @@
//TODO: does separate hasRelationship method in IdentityStore makes sense?
- Set<IdentityObjectRelationship> rels =
getRepository().resolveRelationships(getInvocationContext(),
createIdentityObject(identity), createIdentityObject(group), ROLE);
+ Set<IdentityObjectRelationship> rels =
getRepository().resolveRelationships(getInvocationContext(), createIdentityObject(group),
createIdentityObject(identity), ROLE);
for (IdentityObjectRelationship rel : rels)
{
@@ -285,7 +285,7 @@
checkNotNullArgument(identity, "User");
checkNotNullArgument(group, "Group");
- Set<IdentityObjectRelationship> rels =
getRepository().resolveRelationships(getInvocationContext(),
createIdentityObject(identity), createIdentityObject(group), ROLE);
+ Set<IdentityObjectRelationship> rels =
getRepository().resolveRelationships(getInvocationContext(), createIdentityObject(group),
createIdentityObject(identity), ROLE);
Set<RoleType> types = new HashSet<RoleType>();
for (IdentityObjectRelationship rel : rels)
@@ -400,7 +400,7 @@
Collection<IdentityObject> ios = null;
- ios = getRepository().findIdentityObject(getInvocationContext(),
createIdentityObject(identity), ROLE, true, convertSearchControls(controls));
+ ios = getRepository().findIdentityObject(getInvocationContext(),
createIdentityObject(identity), ROLE, false, convertSearchControls(controls));
for (IdentityObject io : ios)
{
@@ -431,7 +431,7 @@
Collection<IdentityObject> ios = null;
- ios = getRepository().findIdentityObject(getInvocationContext(),
createIdentityObject(identity), ROLE, true, convertSearchControls(controls));
+ ios = getRepository().findIdentityObject(getInvocationContext(),
createIdentityObject(identity), ROLE, false, convertSearchControls(controls));
for (IdentityObject io : ios)
{
@@ -467,19 +467,19 @@
// If Identity then search for parent relationships
if (identityType instanceof User)
{
- relationships = getRepository().resolveRelationships(getInvocationContext(),
createIdentityObject(identityType), ROLE, true, true, null);
+ relationships = getRepository().resolveRelationships(getInvocationContext(),
createIdentityObject(identityType), ROLE, false, true, null);
}
// If Group then search for child relationships
else
{
- relationships = getRepository().resolveRelationships(getInvocationContext(),
createIdentityObject(identityType), ROLE, false, true, null);
+ relationships = getRepository().resolveRelationships(getInvocationContext(),
createIdentityObject(identityType), ROLE, true, true, null);
}
for (IdentityObjectRelationship relationship : relationships)
{
if (roleType.getName().equals(relationship.getName()))
{
- roles.add(new SimpleRole(new SimpleRoleType(relationship.getName()),
createUser(relationship.getFromIdentityObject()),
createGroup(relationship.getToIdentityObject())));
+ roles.add(new SimpleRole(new SimpleRoleType(relationship.getName()),
createUser(relationship.getToIdentityObject()),
createGroup(relationship.getFromIdentityObject())));
}
}
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
21:22:32 UTC (rev 381)
+++
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/repository/FallbackIdentityStoreRepository.java 2009-03-19
12:54:42 UTC (rev 382)
@@ -58,6 +58,7 @@
import java.util.Comparator;
import java.util.Arrays;
import java.util.ArrayList;
+import java.util.LinkedHashSet;
/**
* <p>In FallbackIdentityStoreRepository one IdentityStore plays the role of
default store. Any operation that cannot be
@@ -441,7 +442,7 @@
Collection<IdentityObject> results = new LinkedList<IdentityObject>();
- if (!RoleManagerImpl.ROLE.getName().equals(relationshipType.getName()) ||
+ if (relationshipType == null ||
!RoleManagerImpl.ROLE.getName().equals(relationshipType.getName()) ||
mappedStore.getSupportedFeatures().isNamedRelationshipsSupported())
{
results = mappedStore.findIdentityObject(mappedCtx, identity, relationshipType,
parent, controls);
@@ -484,15 +485,16 @@
// If default store contain related relationships merge and sort/page once more
if (objects != null && objects.size() != 0)
{
+
results.addAll(objects);
- //TODO: hardcoded List
+ //TODO: hardcoded - expects List
if (pageSearchControl != null && results instanceof List)
{
results = cutPageFromResults((List<IdentityObject>)results,
pageSearchControl);
}
- //TODO: hardcoded List
+ //TODO: hardcoded - expects List
if (sortSearchControl != null && results instanceof List)
{
sortByName((List<IdentityObject>)results,
sortSearchControl.isAscending());
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
21:22:32 UTC (rev 381)
+++
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/APITestCase.java 2009-03-19
12:54:42 UTC (rev 382)
@@ -102,6 +102,25 @@
relationshipManagerTest.testMethods("realm://RedHat/DB_LDAP");
}
+ public void testDBRelationshipManagerMergedRoleAssociations() throws Exception
+ {
+ identitySessionFactory = new IdentityConfigurationImpl().
+ configure(new
File("src/test/resources/organization-test-config.xml")).buildIdentitySessionFactory();
+
+ relationshipManagerTest.testMergedRoleAssociations("realm://RedHat/DB");
+ }
+
+ public void testLDAPMixedRelationshipManagerMergedRoleAssociations() throws Exception
+ {
+ populateClean();
+
+ identitySessionFactory = new IdentityConfigurationImpl().
+ configure(new
File("src/test/resources/organization-test-config.xml")).buildIdentitySessionFactory();
+
+
+
relationshipManagerTest.testMergedRoleAssociations("realm://RedHat/DB_LDAP");
+ }
+
public void testDBRoleManager() throws Exception
{
identitySessionFactory = new IdentityConfigurationImpl().
Modified:
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/RelationshipManagerTest.java 2009-03-18
21:22:32 UTC (rev 381)
+++
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/RelationshipManagerTest.java 2009-03-19
12:54:42 UTC (rev 382)
@@ -253,6 +253,7 @@
// Find groups
// #1
+ assertEquals(3, session.getRelationshipManager().findAssociatedGroups(group2, null,
true, false).size());
assertEquals(2, session.getRelationshipManager().findAssociatedGroups(group2,
DEPARTMENT, true, false).size());
assertEquals(1, session.getRelationshipManager().findAssociatedGroups(group2,
ORGANIZATION_UNIT, true, false).size());
assertEquals(0, session.getRelationshipManager().findAssociatedGroups(group2,
ORGANIZATION, true, false).size());
@@ -266,6 +267,7 @@
assertEquals(1, session.getRelationshipManager().findAssociatedGroups(group3,
ORGANIZATION_UNIT, false, false).size());
assertEquals(1, session.getRelationshipManager().findAssociatedGroups(group4,
ORGANIZATION_UNIT, false, false).size());
assertEquals(0, session.getRelationshipManager().findAssociatedGroups(group2,
ORGANIZATION, false, false).size());
+ assertEquals(3, session.getRelationshipManager().findAssociatedGroups(group2, null,
true, false).size());
// #4
assertEquals(1,
session.getRelationshipManager().findAssociatedGroups(group3.getId(), ORGANIZATION_UNIT,
false, false, null).size());
@@ -287,6 +289,7 @@
// #7
assertEquals(1, session.getRelationshipManager().findAssociatedGroups(user1,
ORGANIZATION).size());
assertEquals(0, session.getRelationshipManager().findAssociatedGroups(user1,
ORGANIZATION_UNIT).size());
+ assertEquals(2, session.getRelationshipManager().findAssociatedGroups(user2,
(String)null).size());
assertEquals(1, session.getRelationshipManager().findAssociatedGroups(user2,
ORGANIZATION).size());
assertEquals(1, session.getRelationshipManager().findAssociatedGroups(user2,
ORGANIZATION_UNIT).size());
assertEquals(1, session.getRelationshipManager().findAssociatedGroups(user3,
ORGANIZATION).size());
@@ -317,6 +320,59 @@
}
+ public void testMergedRoleAssociations(String realmName) throws Exception
+ {
+ IdentitySessionFactory factory = ctx.getIdentitySessionFactory();
+ IdentitySession session = factory.createIdentitySession(realmName);
+ session.getTransaction().start();
+
+ // Create stuff
+ 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);
+
+ // Associate
+
+ session.getRelationshipManager().associateGroups(group1, group2);
+ session.getRelationshipManager().associateGroups(group1, group3);
+ session.getRelationshipManager().associateUsers(group1, user1);
+ session.getRelationshipManager().associateUsers(group1, user2);
+
+ session.getRoleManager().createRoleType("rt1");
+ session.getRoleManager().createRoleType("rt2");
+
+ session.getRoleManager().createRole("rt1", user1.getName(),
group1.getId());
+ session.getRoleManager().createRole("rt1", user3.getName(),
group1.getId());
+ session.getRoleManager().createRole("rt1", user4.getName(),
group1.getId());
+ session.getRoleManager().createRole("rt2", user3.getName(),
group1.getId());
+
+ session.getRoleManager().createRole("rt1", user3.getName(),
group2.getId());
+ session.getRoleManager().createRole("rt2", user2.getName(),
group3.getId());
+
+ // Assert
+
+ assertEquals(2, session.getRelationshipManager().findAssociatedUsers(group1, false,
null).size());
+ assertEquals(4, session.getRelationshipManager().findRelatedUsers(group1,
null).size());
+
+ assertEquals(0, session.getRelationshipManager().findAssociatedUsers(group2, false,
null).size());
+ assertEquals(1, session.getRelationshipManager().findRelatedUsers(group2,
null).size());
+
+ assertEquals(0, session.getRelationshipManager().findAssociatedGroups(user3,
(IdentitySearchControl[])null).size());
+ assertEquals(2, session.getRelationshipManager().findRelatedGroups(user3, null,
null).size());
+
+ assertEquals(1, session.getRelationshipManager().findAssociatedGroups(user2,
(IdentitySearchControl[])null).size());
+ assertEquals(2, session.getRelationshipManager().findRelatedGroups(user2, null,
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 21:22:32 UTC
(rev 381)
+++ idm/trunk/idm/src/test/resources/organization-test-config.xml 2009-03-19 12:54:42 UTC
(rev 382)
@@ -165,34 +165,34 @@
<identity-object-type>
<name>USER</name>
<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>
-
<relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
-
<identity-object-type-ref>OFFICE</identity-object-type-ref>
- </relationship>
- <relationship>
-
<relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
-
<identity-object-type-ref>SECURITY</identity-object-type-ref>
- </relationship>
- <relationship>
-
<relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
-
<identity-object-type-ref>ORGANIZATION_UNIT</identity-object-type-ref>
- </relationship>
- <relationship>
-
<relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
-
<identity-object-type-ref>PROJECT</identity-object-type-ref>
- </relationship>
- <relationship>
-
<relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
-
<identity-object-type-ref>PEOPLE</identity-object-type-ref>
- </relationship>
+ <!--<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>-->
+
<!--<relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>-->
+
<!--<identity-object-type-ref>OFFICE</identity-object-type-ref>-->
+ <!--</relationship>-->
+ <!--<relationship>-->
+
<!--<relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>-->
+
<!--<identity-object-type-ref>SECURITY</identity-object-type-ref>-->
+ <!--</relationship>-->
+ <!--<relationship>-->
+
<!--<relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>-->
+
<!--<identity-object-type-ref>ORGANIZATION_UNIT</identity-object-type-ref>-->
+ <!--</relationship>-->
+ <!--<relationship>-->
+
<!--<relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>-->
+
<!--<identity-object-type-ref>PROJECT</identity-object-type-ref>-->
+ <!--</relationship>-->
+ <!--<relationship>-->
+
<!--<relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>-->
+
<!--<identity-object-type-ref>PEOPLE</identity-object-type-ref>-->
+ <!--</relationship>-->
</relationships>
<credentials>
<credential-type>PASSWORD</credential-type>
@@ -213,6 +213,10 @@
<name>ORGANIZATION</name>
<relationships>
<relationship>
+
<relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
+
<identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
<relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
<identity-object-type-ref>USER</identity-object-type-ref>
</relationship>
@@ -237,6 +241,10 @@
<name>ORGANIZATION_UNIT</name>
<relationships>
<relationship>
+
<relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
+
<identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
<relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
<identity-object-type-ref>USER</identity-object-type-ref>
</relationship>
@@ -273,6 +281,10 @@
<name>DIVISION</name>
<relationships>
<relationship>
+
<relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
+
<identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
<relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
<identity-object-type-ref>USER</identity-object-type-ref>
</relationship>
@@ -293,6 +305,10 @@
<name>DEPARTMENT</name>
<relationships>
<relationship>
+
<relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
+
<identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
<relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
<identity-object-type-ref>USER</identity-object-type-ref>
</relationship>
@@ -313,6 +329,10 @@
<name>PROJECT</name>
<relationships>
<relationship>
+
<relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
+
<identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
<relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
<identity-object-type-ref>USER</identity-object-type-ref>
</relationship>
@@ -325,6 +345,10 @@
<name>PEOPLE</name>
<relationships>
<relationship>
+
<relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
+
<identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
<relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
<identity-object-type-ref>USER</identity-object-type-ref>
</relationship>
@@ -337,6 +361,10 @@
<name>ADMINISTRATION</name>
<relationships>
<relationship>
+
<relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
+
<identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
<relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
<identity-object-type-ref>USER</identity-object-type-ref>
</relationship>
@@ -349,6 +377,10 @@
<name>COMMUNITY</name>
<relationships>
<relationship>
+
<relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
+
<identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
<relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
<identity-object-type-ref>USER</identity-object-type-ref>
</relationship>
@@ -361,6 +393,10 @@
<name>OFFICE</name>
<relationships>
<relationship>
+
<relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
+
<identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
<relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
<identity-object-type-ref>USER</identity-object-type-ref>
</relationship>
@@ -373,6 +409,10 @@
<name>SECURITY</name>
<relationships>
<relationship>
+
<relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
+
<identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
<relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
<identity-object-type-ref>USER</identity-object-type-ref>
</relationship>
@@ -385,6 +425,10 @@
<name>SYSTEM</name>
<relationships>
<relationship>
+
<relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
+
<identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
<relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
<identity-object-type-ref>USER</identity-object-type-ref>
</relationship>
Modified:
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/PersistenceManager.java
===================================================================
---
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/PersistenceManager.java 2009-03-18
21:22:32 UTC (rev 381)
+++
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/PersistenceManager.java 2009-03-19
12:54:42 UTC (rev 382)
@@ -27,7 +27,7 @@
import java.util.Collection;
/**
- * Exposes all management operations on Group and Identity objects.
+ * Exposes all management operations on Group and User objects.
*
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw
Dawidowicz</a>
* @version : 0.1 $
@@ -50,7 +50,7 @@
// Create
/**
- * <p>Create an identity in the realm</p>
+ * <p>Create User object</p>
* @param userName
* @throws IdentityException
* @return
@@ -67,7 +67,7 @@
throws IdentityException;
/**
- * <p>Create a group Id</p>
+ * <p>Create a group Id. Result string can be used in other methods</p>
* @param groupName
* @param groupType
* @return
Modified:
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RelationshipManager.java
===================================================================
---
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RelationshipManager.java 2009-03-18
21:22:32 UTC (rev 381)
+++
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RelationshipManager.java 2009-03-19
12:54:42 UTC (rev 382)
@@ -58,6 +58,15 @@
/**
* <p>Associate groups</p>
+ * @param parent
+ * @param members
+ * @throws org.jboss.identity.idm.exception.IdentityException
+ */
+ void associateGroups(Group parent, Collection<Group> members)
+ throws IdentityException;
+
+ /**
+ * <p>Associate groups</p>
* @param parentIds
* @param memberIds
* @throws org.jboss.identity.idm.exception.IdentityException
@@ -67,6 +76,15 @@
/**
* <p>Associate groups</p>
+ * @param parentId
+ * @param memberIds
+ * @throws org.jboss.identity.idm.exception.IdentityException
+ */
+ void associateGroupsByIds(String parentId, Collection<String> memberIds)
+ throws IdentityException;
+
+ /**
+ * <p>Associate groups</p>
* @param parent
* @param member
* @throws org.jboss.identity.idm.exception.IdentityException
@@ -93,6 +111,15 @@
throws IdentityException;
/**
+ * <p>Associate identities to group</p>
+ * @param parent
+ * @param members
+ * @throws org.jboss.identity.idm.exception.IdentityException
+ */
+ void associateUsers(Group parent, Collection<User> members)
+ throws IdentityException;
+
+ /**
* <p>Associate identities to groups</p>
* @param parents
* @param members
@@ -103,6 +130,15 @@
/**
* <p>Associate identities to groups</p>
+ * @param parentId
+ * @param members
+ * @throws org.jboss.identity.idm.exception.IdentityException
+ */
+ void associateUsersByIds(String parentId, Collection<String> members)
+ throws IdentityException;
+
+ /**
+ * <p>Associate identities to groups</p>
* @param parents
* @param members
* @throws org.jboss.identity.idm.exception.IdentityException
@@ -130,6 +166,15 @@
/**
* <p>Disassociate groups</p>
+ * @param parent
+ * @param members
+ * @throws org.jboss.identity.idm.exception.IdentityException
+ */
+ void disassociateGroups(Group parent, Collection<Group> members)
+ throws IdentityException;
+
+ /**
+ * <p>Disassociate groups</p>
* @param parents
* @param members
* @throws org.jboss.identity.idm.exception.IdentityException
@@ -138,6 +183,15 @@
throws IdentityException;
/**
+ * <p>Disassociate groups</p>
+ * @param parent
+ * @param members
+ * @throws org.jboss.identity.idm.exception.IdentityException
+ */
+ void disassociateGroupsByIds(String parent, Collection<String> members)
+ throws IdentityException;
+
+ /**
* <p>Disassociate identities from groups</p>
* @param parents
* @param members
@@ -148,6 +202,15 @@
/**
* <p>Disassociate identities from groups</p>
+ * @param parent
+ * @param members
+ * @throws org.jboss.identity.idm.exception.IdentityException
+ */
+ void disassociateUsers(Group parent, Collection<User> members)
+ throws IdentityException;
+
+ /**
+ * <p>Disassociate identities from groups</p>
* @param parents
* @param members
* @throws org.jboss.identity.idm.exception.IdentityException
@@ -156,6 +219,15 @@
throws IdentityException;
/**
+ * <p>Disassociate identities from groups</p>
+ * @param parent
+ * @param members
+ * @throws org.jboss.identity.idm.exception.IdentityException
+ */
+ void disassociateUsersByIds(String parent, Collection<String> members)
+ throws IdentityException;
+
+ /**
* <p>Check if association is present </p>
* @param parents
* @param members
@@ -381,5 +453,60 @@
boolean inherited,
IdentitySearchControl[] controls) throws
IdentityException;
+
+ /**
+ * Find all groups that given identity is associated with.
+ * If the paginatedSearch or orderedSearch operations
+ * are not supported, dedicated parameters will
+ * take no effect
+ *
+ * @param user child identity
+ * @param groupType can be null
+ * @return
+ * @throws org.jboss.identity.idm.exception.IdentityException
+ */
+ Collection<Group> findRelatedGroups(User user,
+ String groupType,
+ IdentitySearchControl[] controls) throws
IdentityException;
+
+ /**
+ * Find all groups that given identity is associated with.
+ * If the paginatedSearch or orderedSearch operations
+ * are not supported, dedicated parameters will
+ * take no effect
+ *
+ * @param userName child identity name
+ * @param groupType can be null
+ * @return
+ * @throws org.jboss.identity.idm.exception.IdentityException
+ */
+ Collection<Group> findRelatedGroups(String userName,
+ String groupType,
+ IdentitySearchControl[] controls) throws
IdentityException;
+
+ /**
+ * Find identities that have relationship with given parent group.
+ * If the paginatedSearch or orderedSearch operations
+ * are not supported in this store implementation, dedicated parameters will
+ * take no effect
+ *
+ * @param group parent group
+ * @return
+ * @throws org.jboss.identity.idm.exception.IdentityException
+ */
+ Collection<User> findRelatedUsers(Group group, IdentitySearchControl[] controls)
throws IdentityException;
+
+ /**
+ * Find identities that have relationship with given parent group.
+ * If the paginatedSearch or orderedSearch operations
+ * are not supported in this store implementation, dedicated parameters will
+ * take no effect
+ *
+ * @param groupId parent group id
+ * @return
+ * @throws org.jboss.identity.idm.exception.IdentityException
+ */
+ Collection<User> findRelatedUsers(String groupId, IdentitySearchControl[]
controls) throws IdentityException;
+
}