use of edu.internet2.middleware.grouperClient.ws.beans.WsAddMemberResults in project uhgroupings by uhawaii-system-its-ti-iam.
the class GrouperFactoryServiceTest method makeWsAddMemberResultsTest.
@Test
public void makeWsAddMemberResultsTest() {
WsAddMemberResults results;
List<String> members = new ArrayList<>();
members.add(users.get(0).getUsername());
WsSubjectLookup lookup = gfsl.makeWsSubjectLookup(users.get(0).getUsername());
results = gfsl.makeWsAddMemberResults(GROUPING_3_PATH, lookup, members);
assertTrue(results.getResultMetadata().getResultCode().startsWith("SUCCESS"));
}
use of edu.internet2.middleware.grouperClient.ws.beans.WsAddMemberResults in project uhgroupings by uhawaii-system-its-ti-iam.
the class GrouperFactoryServiceImplLocal method makeWsAddMemberResults.
@Override
public WsAddMemberResults makeWsAddMemberResults(String group, WsSubjectLookup lookup, Person personToAdd) {
Person newGroupMember;
WsAddMemberResults wsAddMemberResults = new WsAddMemberResults();
WsResultMeta wsResultMeta = new WsResultMeta();
wsResultMeta.setResultCode(SUCCESS);
wsAddMemberResults.setResultMetadata(wsResultMeta);
Grouping grouping = groupingRepository.findByIncludePathOrExcludePathOrCompositePathOrOwnersPath(group, group, group, group);
if (personToAdd.getUsername() != null) {
newGroupMember = personRepository.findByUsername(personToAdd.getUsername());
} else {
newGroupMember = personRepository.findByUuid(personToAdd.getUuid());
}
if (grouping == null) {
Group groupToAddTo = groupRepository.findByPath(group);
addMember(groupToAddTo, newGroupMember);
} else {
boolean inBasis = grouping.getBasis().isMember(newGroupMember);
boolean inExclude = grouping.getExclude().isMember(newGroupMember);
boolean inInclude = grouping.getInclude().isMember(newGroupMember);
if (group.endsWith(OWNERS)) {
addMember(grouping.getOwners(), newGroupMember);
} else if (group.endsWith(EXCLUDE)) {
if (inBasis) {
addMember(grouping.getExclude(), newGroupMember);
} else if (inInclude) {
deleteMember(grouping.getInclude(), newGroupMember);
}
} else if (group.endsWith(INCLUDE)) {
if (inExclude) {
deleteMember(grouping.getExclude(), newGroupMember);
} else if (!inBasis) {
addMember(grouping.getInclude(), newGroupMember);
}
}
grouping = groupingRepository.findByPath(grouping.getPath());
Group composite = buildComposite(grouping.getInclude(), grouping.getExclude(), grouping.getBasis(), grouping.getPath());
groupRepository.save(composite);
}
return wsAddMemberResults;
}
use of edu.internet2.middleware.grouperClient.ws.beans.WsAddMemberResults in project uhgroupings by uhawaii-system-its-ti-iam.
the class GrouperFactoryServiceImpl method makeWsAddMemberResults.
@Override
public WsAddMemberResults makeWsAddMemberResults(String group, WsSubjectLookup lookup, List<String> newMembers) {
GcAddMember addMember = new GcAddMember();
addMember.assignActAsSubject(lookup);
addMember.assignGroupName(group);
newMembers.forEach(addMember::addSubjectIdentifier);
return addMember.execute();
}
use of edu.internet2.middleware.grouperClient.ws.beans.WsAddMemberResults in project uhgroupings by uhawaii-system-its-ti-iam.
the class GrouperFactoryServiceImplLocal method makeWsAddMemberResults.
@Override
public WsAddMemberResults makeWsAddMemberResults(String group, WsSubjectLookup lookup, List<String> newMembers) {
WsAddMemberResults wsAddMemberResults = new WsAddMemberResults();
WsResultMeta wsResultMeta = new WsResultMeta();
wsResultMeta.setResultCode(SUCCESS);
for (String username : newMembers) {
WsResultMeta wsResultMetaData = makeWsAddMemberResults(group, lookup, username).getResultMetadata();
if (wsResultMetaData.getResultCode().equals(FAILURE)) {
wsResultMeta = wsResultMetaData;
}
}
wsAddMemberResults.setResultMetadata(wsResultMeta);
return wsAddMemberResults;
}
use of edu.internet2.middleware.grouperClient.ws.beans.WsAddMemberResults in project uhgroupings by uhawaii-system-its-ti-iam.
the class HelperServiceTest method makeGroupingsServiceResult.
@Test
public void makeGroupingsServiceResult() {
String action = "add a member";
String resultCode = "successfully added member";
WsAddMemberResults gr = new WsAddMemberResults();
WsResultMeta resultMeta = new WsResultMeta();
resultMeta.setResultCode(resultCode);
gr.setResultMetadata(resultMeta);
GroupingsServiceResult gsr = helperService.makeGroupingsServiceResult(gr, action);
assertEquals(action, gsr.getAction());
assertEquals(resultCode, gsr.getResultCode());
}
Aggregations