/** * Return the List of root collections accessible by the given IP address * and user principal. * * @param ipAddress * The IP address. * * @param principal * The user principal. * * @return A List of root collections accessible tye the given IP address * and user principal. */ public List<RcCollectionMetadata> getAccessibleRootCollections(String ipAddress, Principal principal) { String user = null; Set<String> groups = null; if (principal != null) { user = principal.getName(); groups = this.getRoles(principal); } ArrayList<RcCollectionMetadata> rcRootCollMdList = new ArrayList<RcCollectionMetadata>(); for (RcCollectionMetadata rcCollMd : this.rcRootCollMdList) { if (rcCollMd.isIpAllowed(ipAddress) && rcCollMd.isUserAllowed(user, groups)) { rcRootCollMdList.add(rcCollMd); } } return rcRootCollMdList; }
/** * Returns a Set of collection metadata accessible by the given IP address * and user principal. * * * @param ipAddress * The IP address. * * @param principal * The user principal. * * @return A Set of RcCollectionMetadata objects accessible by the given IP * address and user principal. */ public Set<RcCollectionMetadata> getAccessibleCollections(String ipAddress, Principal principal) { String user = null; Set<String> groups = null; if (principal != null) { user = principal.getName(); groups = this.getRoles(principal); } HashSet<RcCollectionMetadata> rcCollMdSet = new HashSet<RcCollectionMetadata>(); for (RcCollectionMetadata rcCollMd : this.getCollectionMetadataMap().values()) { if (rcCollMd.isIpAllowed(ipAddress) && rcCollMd.isUserAllowed(user, groups)) { rcCollMdSet.add(rcCollMd); } } return rcCollMdSet; }