Search in sources :

Example 6 with WsGetMembershipsResults

use of edu.internet2.middleware.grouperClient.ws.beans.WsGetMembershipsResults in project uhgroupings by uhawaii-system-its-ti-iam.

the class MembershipServiceImpl method removeSelfOpted.

// removes the self-opted attribute from the membership that corresponds to the user and group
@Override
public GroupingsServiceResult removeSelfOpted(String groupPath, String username) {
    logger.info("removeSelfOpted; group: " + groupPath + "; username: " + username + ";");
    String action = "remove self-opted attribute from the membership of " + username + " to " + groupPath;
    if (mas.isMember(groupPath, username)) {
        if (mas.isSelfOpted(groupPath, username)) {
            WsGetMembershipsResults membershipsResults = hs.membershipsResults(username, groupPath);
            String membershipID = hs.extractFirstMembershipID(membershipsResults);
            return hs.makeGroupingsServiceResult(assignMembershipAttributes(OPERATION_REMOVE_ATTRIBUTE, SELF_OPTED, membershipID), action);
        }
        return hs.makeGroupingsServiceResult(SUCCESS + ", " + username + " was not self-opted into " + groupPath, action);
    }
    return hs.makeGroupingsServiceResult(FAILURE + ", " + username + " is not a member of " + groupPath, action);
}
Also used : WsGetMembershipsResults(edu.internet2.middleware.grouperClient.ws.beans.WsGetMembershipsResults)

Example 7 with WsGetMembershipsResults

use of edu.internet2.middleware.grouperClient.ws.beans.WsGetMembershipsResults in project uhgroupings by uhawaii-system-its-ti-iam.

the class MembershipServiceImpl method addSelfOpted.

// adds the self-opted attribute to the membership between the group and user
@Override
public GroupingsServiceResult addSelfOpted(String groupPath, String username) {
    logger.info("addSelfOpted; group: " + groupPath + "; username: " + username + ";");
    String action = "add self-opted attribute to the membership of " + username + " to " + groupPath;
    if (mas.isMember(groupPath, username)) {
        if (!mas.isSelfOpted(groupPath, username)) {
            WsGetMembershipsResults includeMembershipsResults = hs.membershipsResults(username, groupPath);
            String membershipID = hs.extractFirstMembershipID(includeMembershipsResults);
            return hs.makeGroupingsServiceResult(assignMembershipAttributes(OPERATION_ASSIGN_ATTRIBUTE, SELF_OPTED, membershipID), action);
        }
        return hs.makeGroupingsServiceResult(SUCCESS + ", " + username + " was already self opted into " + groupPath, action);
    }
    return hs.makeGroupingsServiceResult(FAILURE + ", " + username + " is not a member of " + groupPath, action);
}
Also used : WsGetMembershipsResults(edu.internet2.middleware.grouperClient.ws.beans.WsGetMembershipsResults)

Aggregations

WsGetMembershipsResults (edu.internet2.middleware.grouperClient.ws.beans.WsGetMembershipsResults)6 WsMembership (edu.internet2.middleware.grouperClient.ws.beans.WsMembership)3 Test (org.junit.Test)2 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)2 Group (edu.hawaii.its.api.type.Group)1 Membership (edu.hawaii.its.api.type.Membership)1 Person (edu.hawaii.its.api.type.Person)1 WsAttributeAssign (edu.internet2.middleware.grouperClient.ws.beans.WsAttributeAssign)1 WsGroup (edu.internet2.middleware.grouperClient.ws.beans.WsGroup)1 WsResultMeta (edu.internet2.middleware.grouperClient.ws.beans.WsResultMeta)1 WsSubjectLookup (edu.internet2.middleware.grouperClient.ws.beans.WsSubjectLookup)1