use of edu.internet2.middleware.grouperClient.ws.beans.WsAttributeAssign in project uhgroupings by uhawaii-system-its-ti-iam.
the class TestGroupingAssignmentService method grouperTest.
@Test
public void grouperTest() {
List<String> groupPaths = groupingAssignmentService.getGroupPaths(username[0]);
List<String> groupings = new ArrayList<>();
List<String> groupings2 = new ArrayList<>();
if (groupPaths.size() > 0) {
List<WsAttributeAssign> attributes = new ArrayList<>();
for (String path : groupPaths) {
WsGetAttributeAssignmentsResults trioGroups = new GcGetAttributeAssignments().addAttributeDefNameName(TRIO).assignAttributeAssignType(ASSIGN_TYPE_GROUP).addOwnerGroupName(path).execute();
if (trioGroups.getWsAttributeAssigns() != null) {
Collections.addAll(attributes, trioGroups.getWsAttributeAssigns());
}
}
if (attributes.size() > 0) {
groupings.addAll(attributes.stream().map(WsAttributeAssign::getOwnerGroupName).collect(Collectors.toList()));
}
assertNotNull(groupings);
// ////////////////////////////////////////////////////////////////////////////////
GcGetAttributeAssignments trioGroups2 = new GcGetAttributeAssignments().addAttributeDefNameName(TRIO).assignAttributeAssignType(ASSIGN_TYPE_GROUP);
groupPaths.forEach(trioGroups2::addOwnerGroupName);
WsGetAttributeAssignmentsResults attributeAssignmentsResults2 = trioGroups2.execute();
assertNotNull(attributeAssignmentsResults2);
WsAttributeAssign[] wsGroups2 = attributeAssignmentsResults2.getWsAttributeAssigns();
if (wsGroups2 != null && wsGroups2.length > 0) {
for (WsAttributeAssign grouping : wsGroups2) {
groupings2.add(grouping.getOwnerGroupName());
}
}
}
assertNotNull(groupings2);
}
use of edu.internet2.middleware.grouperClient.ws.beans.WsAttributeAssign in project uhgroupings by uhawaii-system-its-ti-iam.
the class MemberAttributeServiceImpl method isSelfOpted.
// return true if the membership between the group and user has the self-opted attribute, false otherwise
@Override
public boolean isSelfOpted(String groupPath, String username) {
logger.info("isSelfOpted; group: " + groupPath + "; username: " + username + ";");
if (isMember(groupPath, username)) {
WsGetMembershipsResults wsGetMembershipsResults = hs.membershipsResults(username, groupPath);
String membershipID = hs.extractFirstMembershipID(wsGetMembershipsResults);
WsAttributeAssign[] wsAttributes = getMembershipAttributes(ASSIGN_TYPE_IMMEDIATE_MEMBERSHIP, SELF_OPTED, membershipID);
for (WsAttributeAssign att : wsAttributes) {
if (att.getAttributeDefNameName() != null) {
if (att.getAttributeDefNameName().equals(SELF_OPTED)) {
return true;
}
}
}
}
return false;
}
use of edu.internet2.middleware.grouperClient.ws.beans.WsAttributeAssign in project uhgroupings by uhawaii-system-its-ti-iam.
the class MemberAttributeServiceImpl method getMembershipAttributes.
// checks to see if a membership has an attribute of a specific type and returns the list if it does
public WsAttributeAssign[] getMembershipAttributes(String assignType, String attributeUuid, String membershipID) {
logger.info("getMembershipAttributes; assignType: " + assignType + "; name: " + attributeUuid + "; membershipID: " + membershipID + ";");
WsGetAttributeAssignmentsResults attributeAssignmentsResults = grouperFS.makeWsGetAttributeAssignmentsResultsForMembership(assignType, attributeUuid, membershipID);
WsAttributeAssign[] wsAttributes = attributeAssignmentsResults.getWsAttributeAssigns();
return wsAttributes != null ? wsAttributes : grouperFS.makeEmptyWsAttributeAssignArray();
}
use of edu.internet2.middleware.grouperClient.ws.beans.WsAttributeAssign in project uhgroupings by uhawaii-system-its-ti-iam.
the class GrouperFactoryServiceImplLocal method attributeAssignsOptIn.
private List<WsAttributeAssign> attributeAssignsOptIn() {
List<WsAttributeAssign> attributeAssigns = new ArrayList<>();
Iterable<Grouping> groupings = groupingRepository.findAll();
for (Grouping grouping : groupings) {
if (grouping.isOptInOn()) {
WsAttributeAssign attributeAssign = new WsAttributeAssign();
attributeAssign.setAttributeDefNameName(OPT_IN);
attributeAssign.setOwnerGroupName(grouping.getPath());
attributeAssigns.add(attributeAssign);
}
}
return attributeAssigns;
}
use of edu.internet2.middleware.grouperClient.ws.beans.WsAttributeAssign in project uhgroupings by uhawaii-system-its-ti-iam.
the class GrouperFactoryServiceImplLocal method attributeAssignsOptOut.
private List<WsAttributeAssign> attributeAssignsOptOut() {
List<WsAttributeAssign> attributeAssigns = new ArrayList<>();
Iterable<Grouping> groupings = groupingRepository.findAll();
for (Grouping grouping : groupings) {
if (grouping.isOptOutOn()) {
WsAttributeAssign attributeAssign = new WsAttributeAssign();
attributeAssign.setAttributeDefNameName(OPT_OUT);
attributeAssign.setOwnerGroupName(grouping.getPath());
attributeAssigns.add(attributeAssign);
}
}
return attributeAssigns;
}
Aggregations