Collection<String> azgs = ref.getAuthzGroups(userId); for (String azgRef : azgs) { if (azgRef.startsWith("/site")) {
/** * Access the List the Users who can unlock the lock for use with this resource. * * @param lock * The lock id string. * @param reference * The resource reference string. * @return A List (User) of the users can unlock the lock (may be empty). */ @SuppressWarnings("unchecked") public List<User> unlockUsers(String lock, String reference) { if (reference == null) { log.warn("unlockUsers(): null resource: " + lock); return new Vector<User>(); } // make a reference for the resource Reference ref = entityManager().newReference(reference); // get this resource's Realms Collection<String> realms = ref.getAuthzGroups(); // get the users who can unlock in these realms List<String> ids = new Vector<String>(); ids.addAll(authzGroupService().getUsersIsAllowed(lock, realms)); // convert the set of Users into a sorted list of users List<User> users = userDirectoryService().getUsers(ids); Collections.sort(users); return users; }
/** * {@inheritDoc} */ public Collection getEntityAuthzGroups(Reference ref, String userId) { // double check that it's mine if (!APPLICATION_ID.equals(ref.getType())) return null; Collection rv = new Vector(); // if the reference is an AuthzGroup, and not a special one // get the list of realms for the azGroup-referenced resource if ((ref.getId() != null) && (ref.getId().length() > 0) && (!ref.getId().startsWith("!"))) { // add the current user's azGroup (for what azGroup stuff everyone can do, i.e. add) ref.addUserAuthzGroup(rv, sessionManager().getCurrentSessionUserId()); // make a new reference on the azGroup's id Reference refnew = entityManager().newReference(ref.getId()); rv.addAll(refnew.getAuthzGroups(userId)); } return rv; }
azgs = ref.getAuthzGroups(userId);