use of edu.internet2.middleware.grouperClient.ws.beans.WsResultMeta in project uhgroupings by uhawaii-system-its-ti-iam.
the class GrouperFactoryServiceImplLocal method makeWsAssignAttributesResultsForMembership.
@Override
public WsAssignAttributesResults makeWsAssignAttributesResultsForMembership(String attributeAssignType, String attributeAssignOperation, String attributeDefNameName, String ownerMembershipId) {
WsAssignAttributesResults wsAssignAttributesResults = new WsAssignAttributesResults();
WsResultMeta wsResultMeta = new WsResultMeta();
wsResultMeta.setResultCode(SUCCESS);
wsAssignAttributesResults.setResultMetadata(wsResultMeta);
Membership membership = membershipRepository.findById(ownerMembershipId);
if (attributeAssignOperation.equals(OPERATION_ASSIGN_ATTRIBUTE)) {
membership.setSelfOpted(true);
} else if (attributeAssignOperation.equals(OPERATION_REMOVE_ATTRIBUTE)) {
membership.setSelfOpted(false);
}
membershipRepository.save(membership);
return wsAssignAttributesResults;
}
use of edu.internet2.middleware.grouperClient.ws.beans.WsResultMeta in project uhgroupings by uhawaii-system-its-ti-iam.
the class GrouperFactoryServiceImplLocal method makeWsHasMemberResults.
@Override
public WsHasMemberResults makeWsHasMemberResults(String group, Person person) {
WsHasMemberResults wsHasMemberResults = new WsHasMemberResults();
WsHasMemberResult wsHasMemberResult = new WsHasMemberResult();
WsResultMeta wsResultMeta = new WsResultMeta();
wsHasMemberResult.setResultMetadata(wsResultMeta);
wsHasMemberResults.setResults(new WsHasMemberResult[] { wsHasMemberResult });
wsResultMeta.setResultCode("not member");
Group groupToCheck = groupRepository.findByPath(group);
// first try username
if (person.getUsername() != null) {
person = personRepository.findByUsername(person.getUsername());
if (groupToCheck.isMember(person)) {
wsResultMeta.setResultCode(IS_MEMBER);
}
// if username is null, try uuid
} else if (person.getUuid() != null) {
Person person0 = personRepository.findByUuid(person.getUuid());
if (groupToCheck.isMember(person0)) {
wsResultMeta.setResultCode(IS_MEMBER);
}
}
return wsHasMemberResults;
}
use of edu.internet2.middleware.grouperClient.ws.beans.WsResultMeta 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());
}
use of edu.internet2.middleware.grouperClient.ws.beans.WsResultMeta in project uhgroupings by uhawaii-system-its-ti-iam.
the class GrouperFactoryServiceImplLocal method makeWsAssignAttributesResultsForGroup.
@Override
public WsAssignAttributesResults makeWsAssignAttributesResultsForGroup(WsSubjectLookup lookup, String attributeAssignType, String attributeAssignOperation, String attributeDefNameName, String ownerGroupName) {
WsAssignAttributesResults wsAssignAttributesResults;
Grouping grouping = groupingRepository.findByPath(ownerGroupName);
Person person = personRepository.findByUsername(lookup.getSubjectIdentifier());
if (grouping.getOwners().isMember(person)) {
wsAssignAttributesResults = makeWsAssignAttributesResultsForGroup(attributeAssignType, attributeAssignOperation, attributeDefNameName, ownerGroupName);
} else {
wsAssignAttributesResults = new WsAssignAttributesResults();
WsResultMeta wsResultMeta = new WsResultMeta();
wsResultMeta.setResultCode(FAILURE);
wsAssignAttributesResults.setResultMetadata(wsResultMeta);
}
return wsAssignAttributesResults;
}
use of edu.internet2.middleware.grouperClient.ws.beans.WsResultMeta in project uhgroupings by uhawaii-system-its-ti-iam.
the class GrouperFactoryServiceImplLocal method addEmptyGroup.
@Override
public WsGroupSaveResults addEmptyGroup(String username, String path) {
Group newGroup = new Group(path);
groupRepository.save(newGroup);
WsGroupSaveResults wsGroupSaveResults = new WsGroupSaveResults();
WsResultMeta wsResultMeta = new WsResultMeta();
wsResultMeta.setResultCode(SUCCESS);
wsGroupSaveResults.setResultMetadata(wsResultMeta);
return wsGroupSaveResults;
}
Aggregations