/** * Returns an <code>IEntity</code> representing a portal entity. This does not guarantee that * the entity actually exists. * * @param key String - the group key. * @param type Class - the Class of the underlying IGroupMember. * @return org.apereo.portal.groups.IEntity */ public static IEntity getEntity(String key, Class<?> type) throws GroupsException { return getEntity(key, type, null); }
/** * Returns an <code>IEntity</code> representing a portal entity. This does not guarantee that * the entity actually exists. * * @param key String - the group key. * @param type Class - the Class of the underlying IGroupMember. * @return org.apereo.portal.groups.IEntity */ public static IEntity getEntity(String key, Class<?> type) throws GroupsException { return getEntity(key, type, null); }
public List<JsonEntityBean> getParentGroups(String target) { IGroupMember member = GroupService.getEntity(target, IPerson.class); List<JsonEntityBean> parents = new ArrayList<>(); for (IEntityGroup ancestor : member.getAncestorGroups()) { parents.add(groupListHelper.getEntity(ancestor)); } Collections.sort(parents); return parents; }
@Override public boolean isUserDeepMemberOf(String userName, String groupKey) { final IEntityGroup distinguishedGroup = GroupService.findGroup(groupKey); if (distinguishedGroup == null) { if (this.logger.isDebugEnabled()) { this.logger.debug("No group found for key '" + groupKey + "'"); } return false; } final IEntity entity = GroupService.getEntity(userName, IPerson.class); if (entity == null) { if (this.logger.isDebugEnabled()) { this.logger.debug("No user found for key '" + userName + "'"); } return false; } return distinguishedGroup.deepContains(entity); }
@Override public boolean isUserDeepMemberOf(String userName, String groupKey) { final IEntityGroup distinguishedGroup = GroupService.findGroup(groupKey); if (distinguishedGroup == null) { if (this.logger.isDebugEnabled()) { this.logger.debug("No group found for key '" + groupKey + "'"); } return false; } final IEntity entity = GroupService.getEntity(userName, IPerson.class); if (entity == null) { if (this.logger.isDebugEnabled()) { this.logger.debug("No user found for key '" + userName + "'"); } return false; } return distinguishedGroup.deepContains(entity); }
/** * Find {@link IPerson} as {@link IGroupMember}. * * @param person {@code IPerson} with entity identifier key to look up * @return person as {@code IGroupMember} * @see org.apereo.portal.services.GroupService#getEntity(String, Class) */ private static IGroupMember findPersonAsGroupMember(IPerson person) { String personKey = person.getEntityIdentifier().getKey(); return GroupService.getEntity(personKey, IPerson.class); } }
private IAuthorizationPrincipal getUserPrincipal(final String userName) { final IEntity user = GroupService.getEntity(userName, IPerson.class); if (user == null) { return null; } final AuthorizationServiceFacade authService = AuthorizationServiceFacade.instance(); return authService.newPrincipal(user); }
protected IAuthorizationPrincipal getUserPrincipal(final String userName) { final IEntity user = GroupService.getEntity(userName, IPerson.class); if (user == null) { return null; } final AuthorizationServiceFacade authService = AuthorizationServiceFacade.instance(); return authService.newPrincipal(user); } }
protected IAuthorizationPrincipal getUserPrincipal(final String userName) { final IEntity user = GroupService.getEntity(userName, IPerson.class); if (user == null) { return null; } final AuthorizationServiceFacade authService = AuthorizationServiceFacade.instance(); return authService.newPrincipal(user); } }
/** * Find {@link IPerson} as {@link IGroupMember}. * * @param person {@code IPerson} with entity identifier key to look up * @return person as {@code IGroupMember} * @see org.apereo.portal.services.GroupService#getEntity(String, Class) */ private static IGroupMember findPersonAsGroupMember(IPerson person) { String personKey = person.getEntityIdentifier().getKey(); return GroupService.getEntity(personKey, IPerson.class); } }
entities.add(GroupService.getEntity(key, type));
entities.add(GroupService.getEntity(key, type));
/** @return IEntity */ public IEntity newEntity(Class type, String key) throws GroupsException { if (EntityTypesLocator.getEntityTypes().getEntityIDFromType(type) == null) { throw new GroupsException("Invalid group type: " + type); } return GroupService.getEntity(key, type); } /** @return IEntityGroup */
/** @return IEntity */ public IEntity newEntity(Class type, String key) throws GroupsException { if (EntityTypesLocator.getEntityTypes().getEntityIDFromType(type) == null) { throw new GroupsException("Invalid group type: " + type); } return GroupService.getEntity(key, type); } /** @return IEntityGroup */
final IEntity entity = GroupService.getEntity(userName, IPerson.class); if (entity == null) { if (this.logger.isDebugEnabled()) {
final IEntity entity = GroupService.getEntity(userName, IPerson.class); if (entity == null) { if (this.logger.isDebugEnabled()) {
final IEntity entity = GroupService.getEntity(portletId, IPortletDefinition.class); if (entity == null) { if (this.logger.isDebugEnabled()) {
@Override public Set<PortletCategory> getParentCategories(IPortletDefinition child) { String childKey = child.getPortletDefinitionId().getStringId(); IEntity childEntity = GroupService.getEntity(childKey, IPortletDefinition.class); Set<PortletCategory> parents = new HashSet<>(); for (IGroupMember gm : childEntity.getParentGroups()) { if (gm.isGroup()) { String categoryId = gm.getKey(); parents.add(getPortletCategory(categoryId)); } } return parents; }
@Override public Set<PortletCategory> getParentCategories(IPortletDefinition child) { String childKey = child.getPortletDefinitionId().getStringId(); IEntity childEntity = GroupService.getEntity(childKey, IPortletDefinition.class); Set<PortletCategory> parents = new HashSet<>(); for (IGroupMember gm : childEntity.getParentGroups()) { if (gm.isGroup()) { String categoryId = gm.getKey(); parents.add(getPortletCategory(categoryId)); } } return parents; }
@Transactional @Override public void removePortletDefinition(IPortletDefinition portletDefinition, IPerson person) { IPortletDefinition portletDef = portletDefinitionDao.getPortletDefinition( portletDefinition.getPortletDefinitionId()); // Delete existing category memberships for this portlet String portletDefinitionId = portletDefinition.getPortletDefinitionId().getStringId(); IEntity channelDefEntity = GroupService.getEntity(portletDefinitionId, IPortletDefinition.class); for (IEntityGroup group : channelDefEntity.getAncestorGroups()) { group.removeChild(channelDefEntity); group.update(); } // Delete permissions records that refer to this portlet AuthorizationServiceFacade authService = AuthorizationServiceFacade.instance(); String target = PermissionHelper.permissionTargetIdForPortletDefinition(portletDefinition); IUpdatingPermissionManager upm = authService.newUpdatingPermissionManager(IPermission.PORTAL_SUBSCRIBE); IPermission[] oldPermissions = upm.getPermissionsForTarget(target); upm.removePermissions(oldPermissions); // Delete any ratings (incl. reviews) associated with the portlet marketplaceRatingDao.clearRatingsForPortlet(portletDef); // Delete the portlet itself. portletDefinitionDao.deletePortletDefinition(portletDef); }