use of org.apereo.portal.groups.IEntityGroup in project uPortal by Jasig.
the class EntityPersonAttributesGroupStore method convertPagsGroupToEntity.
private IEntityGroup convertPagsGroupToEntity(IPersonAttributesGroupDefinition group) {
final String cacheKey = group.getName();
Element element = entityGroupCache.get(cacheKey);
if (element == null) {
final IEntityGroup entityGroup = new EntityTestingGroupImpl(group.getName(), IPERSON_CLASS);
entityGroup.setName(group.getName());
entityGroup.setDescription(group.getDescription());
element = new Element(cacheKey, entityGroup);
entityGroupCache.put(element);
}
return (IEntityGroup) element.getObjectValue();
}
use of org.apereo.portal.groups.IEntityGroup in project uPortal by Jasig.
the class EntityPersonAttributesGroupStore method getParentGroups.
private Set<IEntityGroup> getParentGroups(String name, Set<IEntityGroup> groups) throws GroupsException {
logger.debug("Looking up containing groups for {}", name);
IPersonAttributesGroupDefinition pagsGroup = getPagsGroupDefByName(name);
Set<IPersonAttributesGroupDefinition> pagsParentGroups = personAttributesGroupDefinitionDao.getParentPersonAttributesGroupDefinitions(pagsGroup);
for (IPersonAttributesGroupDefinition pagsParent : pagsParentGroups) {
IEntityGroup parent = convertPagsGroupToEntity(pagsParent);
if (!groups.contains(parent)) {
groups.add(parent);
getParentGroups(pagsParent.getName(), groups);
} else {
throw new RuntimeException("Recursive grouping detected! for " + name + " and parent " + pagsParent.getName());
}
}
return groups;
}
use of org.apereo.portal.groups.IEntityGroup in project uPortal by Jasig.
the class EntityPersonAttributesGroupStore method findParentGroups.
@Override
public Iterator<IEntityGroup> findParentGroups(IGroupMember member) throws GroupsException {
if (!IPERSON_CLASS.equals(member.getLeafType())) {
// knowing that PAGS only supports groups of IPerson (we are).
return Collections.emptyIterator();
}
logger.debug("finding containing groups for member key {}", member.getKey());
final Set<IEntityGroup> set = Collections.emptySet();
// default
Iterator<IEntityGroup> rslt = set.iterator();
if (member.isGroup()) {
// PAGS groups may only contain other PAGS groups (and people, of course)
final IEntityGroup ieg = (IEntityGroup) member;
if (PagsService.SERVICE_NAME_PAGS.equals(ieg.getServiceName().toString())) {
rslt = findParentGroupsForGroup((IEntityGroup) member);
}
} else {
rslt = findParentGroupsForEntity((IEntity) member);
}
return rslt;
}
use of org.apereo.portal.groups.IEntityGroup in project uPortal by Jasig.
the class EntityPersonAttributesGroupStore method findParentGroupsForEntity.
private Iterator<IEntityGroup> findParentGroupsForEntity(IEntity member) throws GroupsException {
Set<IPersonAttributesGroupDefinition> pagsGroups = personAttributesGroupDefinitionDao.getPersonAttributesGroupDefinitions();
List<IEntityGroup> results = new ArrayList<IEntityGroup>();
for (IPersonAttributesGroupDefinition pagsGroup : pagsGroups) {
IEntityGroup group = convertPagsGroupToEntity(pagsGroup);
if (contains(group, member)) {
results.add(group);
}
}
return results.iterator();
}
use of org.apereo.portal.groups.IEntityGroup in project uPortal by Jasig.
the class SmartLdapGroupStore method findMemberGroupKeys.
/**
* Returns a <code>String[]</code> containing the keys of <code>IEntityGroups</code> that are
* members of this <code>IEntityGroup</code>. In a composite group system, a group may contain a
* member group from a different service. This is called a foreign membership, and is only
* possible in an internally-managed service. A group store in such a service can return the key
* of a foreign member group, but not the group itself, which can only be returned by its local
* store.
*
* @return String[]
* @param group org.apereo.portal.groups.IEntityGroup
*/
public String[] findMemberGroupKeys(IEntityGroup group) throws GroupsException {
if (isTreeRefreshRequired()) {
refreshTree();
}
log.debug("Invoking findMemberGroupKeys() for group: {}", group.getLocalKey());
List<String> rslt = new LinkedList<>();
for (Iterator it = findMemberGroups(group); it.hasNext(); ) {
IEntityGroup g = (IEntityGroup) it.next();
// Return composite keys here...
rslt.add(g.getKey());
}
return rslt.toArray(new String[rslt.size()]);
}
Aggregations