/** * Returns an <code>IGroupMember</code> representing either a group or a portal entity, based on * the <code>EntityIdentifier</code>, which refers to the UNDERLYING entity for the <code> * IGroupMember</code>. */ public static IGroupMember getGroupMember(EntityIdentifier underlyingEntityIdentifier) throws GroupsException { return getGroupMember( underlyingEntityIdentifier.getKey(), underlyingEntityIdentifier.getType()); }
/** * Returns an <code>IGroupMember</code> representing either a group or a portal entity, based on * the <code>EntityIdentifier</code>, which refers to the UNDERLYING entity for the <code> * IGroupMember</code>. */ public static IGroupMember getGroupMember(EntityIdentifier underlyingEntityIdentifier) throws GroupsException { return getGroupMember( underlyingEntityIdentifier.getKey(), underlyingEntityIdentifier.getType()); }
protected Set<String> getGroupsForUser(IPerson person) { final IGroupMember member = GroupService.getGroupMember(person.getEntityIdentifier()); final Set<String> groupKeys = new LinkedHashSet<>(); for (IGroupMember group : member.getAncestorGroups()) { final String groupKey = group.getKey(); if (IncludeExcludeUtils.included(groupKey, this.groupIncludes, this.groupExcludes)) { groupKeys.add(groupKey); } } return groupKeys; }
final IGroupMember group = GroupService.getGroupMember(results[0]);
final IGroupMember group = GroupService.getGroupMember(results[0]);
return GroupService.getGroupMember(results[0]);
return GroupService.getGroupMember(results[0]);
group = (IEntityGroup) GroupService.getGroupMember(results[0]); return groupMember.isDeepMemberOf(group); } catch (Exception e) {
final IGroupMember groupMember = GroupService.getGroupMember(username, IPerson.class); if (groupMember != null) { Set<IEntityGroup> ancestors = groupMember.getAncestorGroups();
@Override public Set<Entity> getGroupsForMember(String memberName) { Set<Entity> groups = new HashSet<Entity>(); if (StringUtils.isNotEmpty(memberName)) { EntityIdentifier[] identifiers = GroupService.searchForEntities( memberName, GroupService.SearchMethod.DISCRETE, EntityEnum.PERSON.getClazz()); for (EntityIdentifier entityIdentifier : identifiers) { if (entityIdentifier.getType().equals(EntityEnum.PERSON.getClazz())) { IGroupMember groupMember = GroupService.getGroupMember(entityIdentifier); if (memberName.equalsIgnoreCase(groupMember.getKey())) { Iterator it = GroupService.findParentGroups(groupMember); while (it.hasNext()) { IEntityGroup g = (IEntityGroup) it.next(); Entity e = EntityFactory.createEntity( g, EntityEnum.getEntityEnum(g.getLeafType(), true)); groups.add(e); } return groups; } } } } return groups; }
@RenderMapping public String renderAnalyticsHeader(RenderRequest request, ModelMap model) throws IOException { // For which user account are we logging portal activity? final HttpServletRequest req = portalRequestUtils.getCurrentPortalRequest(); final IPerson person = personManager.getPerson(req); final String username = person.getUserName(); final IGroupMember groupMember = GroupService.getGroupMember(username, IPerson.class); final Map<String, Boolean> isMemberCache = new HashMap<>(); final PortletPreferences preferences = request.getPreferences(); final JsonNode config = this.portletPreferencesJsonDao.getJsonNode( preferences, GoogleAnalyticsConfigController.CONFIG_PREF_NAME); final JsonNode propertyConfig = config.get("defaultConfig"); this.filterAnalyticsGroups(groupMember, propertyConfig, isMemberCache); final JsonNode hosts = config.get("hosts"); if (hosts != null) { for (final Iterator<JsonNode> hostsItr = hosts.elements(); hostsItr.hasNext(); ) { final JsonNode institution = hostsItr.next(); this.filterAnalyticsGroups(groupMember, institution, isMemberCache); } } model.put("data", config); if (propertyConfig == null || propertyConfig.get("propertyId") == null) { return "jsp/GoogleAnalytics/noop"; } else { return "jsp/GoogleAnalytics/init"; } }
IGroupMember groupMember = GroupService.getGroupMember(ei); boolean isMember = false;
IGroupMember groupMember = GroupService.getGroupMember(entityIdentifier); Entity entity = getEntity(groupMember); results.add(entity);
IGroupMember entity = GroupService.getGroupMember(identifiers[i]); if (entity != null) { JsonEntityBean jsonBean = getEntity(entity);
@Override protected String getSkinName(HttpServletRequest request) { final IUserInstance userInstance = this.userInstanceManager.getUserInstance(request); final IPerson person = userInstance.getPerson(); final EntityIdentifier personIdentifier = person.getEntityIdentifier(); final IGroupMember groupMember = GroupService.getGroupMember(personIdentifier); final Map<IGroupMember, String> groupMemberToSkinMapping = groupMemberToSkinMappingCreator.get(); for (final Entry<IGroupMember, String> groupToSkinEntry : groupMemberToSkinMapping.entrySet()) { final IGroupMember group = groupToSkinEntry.getKey(); if (group.isGroup() && groupMember.isDeepMemberOf(group.asGroup())) { final String skin = groupToSkinEntry.getValue(); getLogger() .debug( "Setting skin override {} for {} because they are a member of {}", new Object[] {skin, person.getUserName(), group}); // Cache the resolution return skin; } } getLogger() .debug( "No user {} is not a member of any configured groups, no skin override will be done", person.getUserName()); return null; }
@Override protected String getSkinName(HttpServletRequest request) { final IUserInstance userInstance = this.userInstanceManager.getUserInstance(request); final IPerson person = userInstance.getPerson(); final EntityIdentifier personIdentifier = person.getEntityIdentifier(); final IGroupMember groupMember = GroupService.getGroupMember(personIdentifier); final Map<IGroupMember, String> groupMemberToSkinMapping = groupMemberToSkinMappingCreator.get(); for (final Entry<IGroupMember, String> groupToSkinEntry : groupMemberToSkinMapping.entrySet()) { final IGroupMember group = groupToSkinEntry.getKey(); if (group.isGroup() && groupMember.isDeepMemberOf(group.asGroup())) { final String skin = groupToSkinEntry.getValue(); getLogger() .debug( "Setting skin override {} for {} because they are a member of {}", new Object[] {skin, person.getUserName(), group}); // Cache the resolution return skin; } } getLogger() .debug( "No user {} is not a member of any configured groups, no skin override will be done", person.getUserName()); return null; }
for (EntityIdentifier entityIdentifier : identifiers) { if (entityIdentifier.getType().equals(IEntityGroup.class)) { IGroupMember groupMember = GroupService.getGroupMember(entityIdentifier); if (groupMember.getLeafType().equals(IPerson.class)) { String groupMemberName =
/** * Receives notice that the UserInstance has been unbound from the HttpSession. In response, we * remove the corresponding group member from the cache. We use the roundabout route of creating * a group member and then getting its EntityIdentifier because we need the EntityIdentifier for * the group member, which is cached, not the EntityIdentifier for the IPerson, which is not. * * @param person org.apereo.portal.security.IPerson */ private void ifinishedSession(IPerson person) throws GroupsException { IGroupMember gm = getGroupMember(person.getEntityIdentifier()); try { final EntityIdentifier entityIdentifier = gm.getEntityIdentifier(); EntityCachingService.getEntityCachingService() .remove(entityIdentifier.getType(), entityIdentifier.getKey()); } catch (CachingException ce) { throw new GroupsException( "Problem removing group member " + gm.getKey() + " from cache", ce); } }
/** * Receives notice that the UserInstance has been unbound from the HttpSession. In response, we * remove the corresponding group member from the cache. We use the roundabout route of creating * a group member and then getting its EntityIdentifier because we need the EntityIdentifier for * the group member, which is cached, not the EntityIdentifier for the IPerson, which is not. * * @param person org.apereo.portal.security.IPerson */ private void ifinishedSession(IPerson person) throws GroupsException { IGroupMember gm = getGroupMember(person.getEntityIdentifier()); try { final EntityIdentifier entityIdentifier = gm.getEntityIdentifier(); EntityCachingService.getEntityCachingService() .remove(entityIdentifier.getType(), entityIdentifier.getKey()); } catch (CachingException ce) { throw new GroupsException( "Problem removing group member " + gm.getKey() + " from cache", ce); } }
group.addChild(member); } else { IGroupMember member = GroupService.getGroupMember(child.getId(), type.getClazz()); group.addChild(member);