use of edu.internet2.middleware.grouperClient.ws.beans.WsAssignAttributesResults in project uhgroupings by uhawaii-system-its-ti-iam.
the class GrouperFactoryServiceTest method makeWsAssignAttributesResultsForGroupLookupVersionTest.
@Test
public void makeWsAssignAttributesResultsForGroupLookupVersionTest() {
WsAssignAttributesResults results;
WsSubjectLookup lookup = gfsl.makeWsSubjectLookup(users.get(0).getUsername());
WsSubjectLookup lookup2 = gfsl.makeWsSubjectLookup(users.get(3).getUsername());
String assignType = "type";
String assignOperation = OPERATION_ASSIGN_ATTRIBUTE;
String removeOperation = OPERATION_REMOVE_ATTRIBUTE;
String defName = LISTSERV;
String defName2 = OPT_IN;
String defName3 = OPT_OUT;
String groupName = GROUPING_3_PATH;
results = gfsl.makeWsAssignAttributesResultsForGroup(lookup, assignType, assignOperation, defName, groupName);
assertTrue(results.getResultMetadata().getResultCode().startsWith("SUCCESS"));
results = gfsl.makeWsAssignAttributesResultsForGroup(lookup2, assignType, assignOperation, defName, groupName);
assertTrue(results.getResultMetadata().getResultCode().startsWith("FAILURE"));
}
use of edu.internet2.middleware.grouperClient.ws.beans.WsAssignAttributesResults in project uhgroupings by uhawaii-system-its-ti-iam.
the class GrouperFactoryServiceTest method makeWsAssignAttributesResultsForGroupTest.
// This test also takes care of setGroupingAttribute(grouping, attributeName, on)
@Test
public void makeWsAssignAttributesResultsForGroupTest() {
WsAssignAttributesResults results;
String assignType = "type";
String assignOperation = OPERATION_ASSIGN_ATTRIBUTE;
String removeOperation = OPERATION_REMOVE_ATTRIBUTE;
String defName = LISTSERV;
String defName2 = OPT_IN;
String defName3 = OPT_OUT;
String groupName = GROUPING_3_PATH;
results = gfsl.makeWsAssignAttributesResultsForGroup(assignType, assignOperation, defName, groupName);
assertTrue(results.getResultMetadata().getResultCode().startsWith("SUCCESS"));
results = gfsl.makeWsAssignAttributesResultsForGroup(assignType, assignOperation, defName2, groupName);
assertTrue(results.getResultMetadata().getResultCode().startsWith("SUCCESS"));
results = gfsl.makeWsAssignAttributesResultsForGroup(assignType, assignOperation, defName3, groupName);
assertTrue(results.getResultMetadata().getResultCode().startsWith("SUCCESS"));
results = gfsl.makeWsAssignAttributesResultsForGroup(assignType, assignOperation, "nothing", groupName);
assertTrue(results.getResultMetadata().getResultCode().startsWith("FAILURE"));
results = gfsl.makeWsAssignAttributesResultsForGroup(assignType, removeOperation, defName, groupName);
assertTrue(results.getResultMetadata().getResultCode().startsWith("SUCCESS"));
}
use of edu.internet2.middleware.grouperClient.ws.beans.WsAssignAttributesResults in project uhgroupings by uhawaii-system-its-ti-iam.
the class MembershipServiceImpl method updateLastModified.
// updates the last modified attribute of the group to the current date and time
@Override
public GroupingsServiceResult updateLastModified(String groupPath) {
logger.info("updateLastModified; group: " + groupPath + ";");
String time = wsDateTime();
WsAttributeAssignValue dateTimeValue = grouperFS.makeWsAttributeAssignValue(time);
WsAssignAttributesResults assignAttributesResults = grouperFS.makeWsAssignAttributesResults(ASSIGN_TYPE_GROUP, OPERATION_ASSIGN_ATTRIBUTE, groupPath, YYYYMMDDTHHMM, OPERATION_REPLACE_VALUES, dateTimeValue);
return hs.makeGroupingsServiceResult(assignAttributesResults, "update last-modified attribute for " + groupPath + " to time " + time);
}
use of edu.internet2.middleware.grouperClient.ws.beans.WsAssignAttributesResults in project uhgroupings by uhawaii-system-its-ti-iam.
the class GrouperFactoryServiceImplLocal method makeWsAssignAttributesResultsForGroup.
@Override
public WsAssignAttributesResults makeWsAssignAttributesResultsForGroup(String attributeAssignType, String attributeAssignOperation, String attributeDefNameName, String ownerGroupName) {
WsAssignAttributesResults wsAssignAttributesResults = new WsAssignAttributesResults();
WsResultMeta wsResultMeta = new WsResultMeta();
wsResultMeta.setResultCode(FAILURE);
Grouping grouping = groupingRepository.findByPath(ownerGroupName);
if (attributeAssignOperation.equals(OPERATION_ASSIGN_ATTRIBUTE)) {
if (setGroupingAttribute(grouping, attributeDefNameName, true)) {
wsResultMeta.setResultCode(SUCCESS);
}
} else if (attributeAssignOperation.equals(OPERATION_REMOVE_ATTRIBUTE)) {
if (setGroupingAttribute(grouping, attributeDefNameName, false)) {
wsResultMeta.setResultCode(SUCCESS);
}
}
wsAssignAttributesResults.setResultMetadata(wsResultMeta);
return wsAssignAttributesResults;
}
use of edu.internet2.middleware.grouperClient.ws.beans.WsAssignAttributesResults 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;
}
Aggregations