@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; JsonEntityBean other = (JsonEntityBean) obj; if (childrenInitialized != other.childrenInitialized) return false; if (creatorId == null) { if (other.creatorId != null) return false; } else if (!creatorId.equals(other.creatorId)) return false; if (description == null) { if (other.description != null) return false; } else if (!description.equals(other.description)) return false; if (entityType == null) { if (other.entityType != null) return false; } else if (!entityType.equals(other.entityType)) return false; if (id == null) { if (other.id != null) return false; } else if (!id.equals(other.id)) return false; if (name == null) { if (other.name != null) return false; } else if (!name.equals(other.name)) return false; return true; }
@Override public Set<String> getEntityTypesForGroupType(String groupType) { // add the group type itself to the allowed list Set<String> set = new HashSet<String>(); set.add(groupType); /* * If the supplied type is a person group, add the person entity type. * If the supplied type is a category, add the channel type. Otherwise, * throw an exception. * * This method will require an update if more entity types are added * in the future. */ EntityEnum type = EntityEnum.getEntityEnum(groupType); if (EntityEnum.GROUP.equals(type)) { set.add(EntityEnum.PERSON.toString()); } else if (EntityEnum.CATEGORY.equals(type)) { set.add(EntityEnum.PORTLET.toString()); } else { throw new IllegalArgumentException( "Unable to determine a root entity for group type '" + groupType + "'"); } return set; }
@Override public JsonEntityBean getRootEntity(String groupType) { EntityEnum type = EntityEnum.getEntityEnum(groupType); String rootKey; if (EntityEnum.GROUP.equals(type)) { rootKey = "local.0"; } else if (EntityEnum.CATEGORY.equals(type)) { IEntityGroup categoryGroup = GroupService.getDistinguishedGroup(IPortletDefinition.DISTINGUISHED_GROUP); return new JsonEntityBean(categoryGroup, EntityEnum.CATEGORY); } else { throw new IllegalArgumentException( "Unable to determine a root entity for group type '" + groupType + "'"); } JsonEntityBean bean = getEntity(groupType, rootKey, false); return bean; }
private AuthorizableActivity getViewActivity( final String activityKey, final JsonEntityBean entity) { if (entity != null && activityKey.equals("VIEW")) { final EntityEnum type = entity.getEntityType(); if (type.isGroup()) { return new AuthorizableActivity( IPermission.PORTAL_GROUPS, IPermission.VIEW_GROUP_ACTIVITY); } else if (type.equals(EntityEnum.PERSON)) { return new AuthorizableActivity( IPermission.PORTAL_USERS, IPermission.VIEW_USER_ACTIVITY); } else if (type.equals(EntityEnum.PORTLET)) { return new AuthorizableActivity( IPermission.PORTAL_SUBSCRIBE, IPermission.PORTLET_SUBSCRIBER_ACTIVITY); } } return null; }
@Override public JsonEntityBean getEntity(IGroupMember member) { // get the type of this member entity EntityEnum entityEnum = getEntityType(member); // construct a new entity bean for this entity JsonEntityBean entity; if (entityEnum.isGroup()) { entity = new JsonEntityBean((IEntityGroup) member, entityEnum); } else { entity = new JsonEntityBean(member, entityEnum); } // if the name hasn't been set yet, look up the entity name if (entity.getName() == null) { entity.setName(lookupEntityName(entity)); } if (EntityEnum.GROUP.equals(entity.getEntityType()) || EntityEnum.PERSON.equals(entity.getEntityType())) { IAuthorizationPrincipal principal = getPrincipalForEntity(entity); entity.setPrincipalString(principal.getPrincipalString()); } return entity; }
|| EntityEnum.PERSON.equals(jsonBean.getEntityType())) { IAuthorizationPrincipal principal = getPrincipalForEntity(jsonBean); jsonBean.setPrincipalString(principal.getPrincipalString()); if (EntityEnum.GROUP.equals(jsonBean.getEntityType()) || EntityEnum.PERSON.equals(jsonBean.getEntityType())) { IAuthorizationPrincipal principal = getPrincipalForEntity(jsonBean); jsonBean.setPrincipalString(principal.getPrincipalString());