for (String groupName : groupNames) { if (groupName != null) { Group group = groupService.findByName(context, groupName); if (group != null) { groups.add(group);
Group ldapGroup = groupService.findByName(context, dspaceGroupName); if (ldapGroup != null) { groupService.addMember(context, ldapGroup, context.getCurrentUser()); groupService.update(context, ldapGroup); } else {
public boolean isCommunityAdmin(Context c) throws SQLException { EPerson e = c.getCurrentUser(); if (e != null) { List<ResourcePolicy> policies = resourcePolicyService.find(c, e, groupService.allMemberGroups(c, e), Constants.ADMIN, Constants.COMMUNITY); if (CollectionUtils.isNotEmpty(policies)) { return true; } } return false; }
@Override public void initDefaultGroupNames(Context context) throws SQLException, AuthorizeException { GroupService groupService = EPersonServiceFactory.getInstance().getGroupService(); // Check for Anonymous group. If not found, create it Group anonymousGroup = groupService.findByName(context, Group.ANONYMOUS); if (anonymousGroup == null) { anonymousGroup = groupService.create(context); anonymousGroup.setName(Group.ANONYMOUS); anonymousGroup.setPermanent(true); groupService.update(context, anonymousGroup); } // Check for Administrator group. If not found, create it Group adminGroup = groupService.findByName(context, Group.ADMIN); if (adminGroup == null) { adminGroup = groupService.create(context); adminGroup.setName(Group.ADMIN); adminGroup.setPermanent(true); groupService.update(context, adminGroup); } }
@Override public Group createWorkflowGroup(Context context, Collection collection, int step) throws SQLException, AuthorizeException { // Check authorisation - Must be an Admin to create Workflow Group AuthorizeUtil.authorizeManageWorkflowsGroup(context, collection); if (getWorkflowGroup(collection, step) == null) { //turn off authorization so that Collection Admins can create Collection Workflow Groups context.turnOffAuthorisationSystem(); Group g = groupService.create(context); context.restoreAuthSystemState(); groupService.setName(g, "COLLECTION_" + collection.getID() + "_WORKFLOW_STEP_" + step); groupService.update(context, g); setWorkflowGroup(context, collection, step, g); } return getWorkflowGroup(collection, step); }
Group wfGroup = collectionService.getWorkflowGroup(wfi.getCollection(), step); if (wfGroup != null) { epList.addAll(groupService.allMembers(c, wfGroup)); Group adGroup = wfi.getCollection().getAdministrators(); if (adGroup != null) { epList.addAll(groupService.allMembers(c, adGroup)); Group group = groupService.findByName(c, contact); if (group != null) { epList.addAll(groupService.allMembers(c, group));
Group collider = groupService.findByName(context, name); // Existing group? if (null != collider) { // Group already exists, so empty it while (groupIterator.hasNext()) { Group member = groupIterator.next(); groupService.removeMember(context, collider, member); if (!(collider.equals(groupService.findByName(context, Group.ADMIN)) && member.equals(context.getCurrentUser()))) { groupService.removeMember(context, collider, member); groupObj = groupService.create(context); groupService.setName(groupObj, name); EPerson memberEPerson = ePersonService.findByEmail(context, memberName); if (null != memberEPerson) { groupService.addMember(context, groupObj, memberEPerson); } else { throw new PackageValidationException("EPerson " + memberName groupService.update(context, groupObj); Group groupObj = groupService.findByName(context, name); log.debug("Looked up the group and found {}", groupObj); NodeList members = group Group memberGroup = groupService.findByName(context, memberName); groupService.addMember(context, groupObj, memberGroup);
groups.add(groupService.find(context, g)); } else { Group group = groupService.findByName(context, groupName); if (group != null) { groups.remove(groupService.find(context, g)); } else { Group group = groupService.findByName(context, groupName); if (group != null) {
StringBuilder resourceQuery = new StringBuilder(); Group anonymousGroup = groupService.findByName(context, Group.ANONYMOUS); String anonGroupId = ""; if (anonymousGroup != null) { Set<Group> groups = groupService.allMemberGroupsSet(context, currentUser); for (Group group : groups) { resourceQuery.append(" OR g").append(group.getID());
return groupService.findAll(context, null); } else if (object.getType() == Constants.COMMUNITY) { Community community = (Community) object; List<Group> matchingGroups = groupService.search(context, "COMMUNITY\\_" + community.getID() + "\\_"); for (Group g : matchingGroups) { if (!list.contains(g)) { List<Group> matchingGroups = groupService.search(context, "COLLECTION\\_" + collection.getID() + "\\_"); for (Group g : matchingGroups) { if (!list.contains(g)) {
if ((workflowStepGroup != null) && !(groupService.isEmpty(workflowStepGroup))) { List<EPerson> epa = groupService.allMembers(context, workflowStepGroup);
public ArrayList<EPerson> getAllUniqueMembers(Context context) throws SQLException { HashMap<UUID, EPerson> epersonsMap = new HashMap(); for (EPerson eperson : epersons) { epersonsMap.put(eperson.getID(), eperson); } for (Group group : groups) { for (EPerson eperson : groupService.allMembers(context, group)) { epersonsMap.put(eperson.getID(), eperson); } } return new ArrayList<>(epersonsMap.values()); } }
/** * Get an array of all of the special groups that current user is a member * of. * * @return list of groups * @throws SQLException if database error */ public List<Group> getSpecialGroups() throws SQLException { List<Group> myGroups = new ArrayList<Group>(); for (UUID groupId : specialGroups) { myGroups.add(EPersonServiceFactory.getInstance().getGroupService().find(this, groupId)); } return myGroups; }
public String getObjectSizesInfo(Context context) throws SQLException { StringBuilder sb = new StringBuilder(); sb.append(String.format("Count %-14s: %s\n", "Bitstream", String.valueOf(bitstreamService.countTotal(context)))); sb.append(String.format("Count %-14s: %s\n", "Bundle", String.valueOf(bundleService.countTotal(context)))); sb.append(String.format("Count %-14s: %s\n", "Collection", String.valueOf(collectionService.countTotal(context)))); sb.append(String.format("Count %-14s: %s\n", "Community", String.valueOf(communityService.countTotal(context)))); sb.append(String.format("Count %-14s: %s\n", "MetadataValue", String.valueOf(metadataValueService.countTotal(context)))); sb.append(String.format("Count %-14s: %s\n", "EPerson", String.valueOf(ePersonService.countTotal(context)))); sb.append(String.format("Count %-14s: %s\n", "Item", String.valueOf(itemService.countTotal(context)))); sb.append(String.format("Count %-14s: %s\n", "Handle", String.valueOf(handleService.countTotal(context)))); sb.append(String.format("Count %-14s: %s\n", "Group", String.valueOf(groupService.countTotal(context)))); sb.append(String.format("Count %-14s: %s\n", "BasicWorkflowItem", String.valueOf(basicWorkflowItemService.countTotal(context)))); sb.append(String.format("Count %-14s: %s\n", "WorkspaceItem", String.valueOf(workspaceItemService.countTotal(context)))); return sb.toString(); }
@Override public PoolTask findByWorkflowIdAndEPerson(Context context, XmlWorkflowItem workflowItem, EPerson ePerson) throws SQLException, AuthorizeException, IOException { PoolTask poolTask = poolTaskDAO.findByWorkflowItemAndEPerson(context, workflowItem, ePerson); //If there is a pooltask for this eperson, return it if (poolTask != null) { return poolTask; } else { //If the user has a is processing or has finished the step for a workflowitem, there is no need to look // for pooltasks for one of his //groups because the user already has the task claimed if (inProgressUserService.findByWorkflowItemAndEPerson(context, workflowItem, ePerson) != null) { return null; } else { //If the user does not have a claimedtask yet, see whether one of the groups of the user has pooltasks //for this workflow item Set<Group> groups = groupService.allMemberGroupsSet(context, ePerson); for (Group group : groups) { poolTask = poolTaskDAO.findByWorkflowItemAndGroup(context, group, workflowItem); if (poolTask != null) { return poolTask; } } } } return null; }
@Override public Group createAdministrators(Context context, Community community) throws SQLException, AuthorizeException { // Check authorisation - Must be an Admin to create more Admins AuthorizeUtil.authorizeManageAdminGroup(context, community); Group admins = community.getAdministrators(); if (admins == null) { //turn off authorization so that Community Admins can create Sub-Community Admins context.turnOffAuthorisationSystem(); admins = groupService.create(context); context.restoreAuthSystemState(); groupService.setName(admins, "COMMUNITY_" + community.getID() + "_ADMIN"); groupService.update(context, admins); } authorizeService.addPolicy(context, community, Constants.ADMIN, admins); // register this as the admin group community.setAdmins(admins); return admins; }
List<Group> result = new ArrayList<>(); for (UUID uuid : sessionGroupIds) { result.add(groupService.find(context, uuid)); Group group = groupService.findByName(context, groupNames[i].trim()); if (group != null) { groups.add(group);
createTaskForEPerson(c, wfi, step, nextAction, workflowItemRole.getEPerson()); } else { List<EPerson> members = groupService.allMembers(c, workflowItemRole.getGroup()); for (EPerson member : members) { createTaskForEPerson(c, wfi, step, nextAction, member);
if (containerType == Constants.COLLECTION) { Collection collection = collectionService.find(c, containerID); Group group = groupService.find(c, groupID);