Search in sources :

Example 1 with WsGetGrouperPrivilegesLiteResult

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

the class MembershipServiceImpl method groupOptOutPermission.

// returns true if the group allows that user to opt out
@Override
public boolean groupOptOutPermission(String optOutUsername, String groupPath) {
    logger.info("groupOptOutPermission; group: " + groupPath + "; username: " + optOutUsername + ";");
    WsGetGrouperPrivilegesLiteResult result = getGrouperPrivilege(optOutUsername, PRIVILEGE_OPT_OUT, groupPath);
    return result.getResultMetadata().getResultCode().equals(SUCCESS_ALLOWED);
}
Also used : WsGetGrouperPrivilegesLiteResult(edu.internet2.middleware.grouperClient.ws.beans.WsGetGrouperPrivilegesLiteResult)

Example 2 with WsGetGrouperPrivilegesLiteResult

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

the class MembershipServiceImpl method getGrouperPrivilege.

// checks to see if the user has the privilege in that group
public WsGetGrouperPrivilegesLiteResult getGrouperPrivilege(String username, String privilegeName, String groupPath) {
    logger.info("getGrouperPrivilege; username: " + username + "; group: " + groupPath + "; privilegeName: " + privilegeName + ";");
    WsSubjectLookup lookup = grouperFS.makeWsSubjectLookup(username);
    return grouperFS.makeWsGetGrouperPrivilegesLiteResult(groupPath, privilegeName, lookup);
}
Also used : WsSubjectLookup(edu.internet2.middleware.grouperClient.ws.beans.WsSubjectLookup)

Example 3 with WsGetGrouperPrivilegesLiteResult

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

the class MembershipServiceImpl method groupOptInPermission.

// returns true if the group allows that user to opt in
@Override
public boolean groupOptInPermission(String optInUsername, String groupPath) {
    logger.info("groupOptInPermission; group: " + groupPath + "; username: " + optInUsername + ";");
    WsGetGrouperPrivilegesLiteResult result = getGrouperPrivilege(optInUsername, PRIVILEGE_OPT_IN, groupPath);
    return result.getResultMetadata().getResultCode().equals(SUCCESS_ALLOWED);
}
Also used : WsGetGrouperPrivilegesLiteResult(edu.internet2.middleware.grouperClient.ws.beans.WsGetGrouperPrivilegesLiteResult)

Example 4 with WsGetGrouperPrivilegesLiteResult

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

the class GrouperFactoryServiceImplLocal method makeWsGetGrouperPrivilegesLiteResult.

@Override
public WsGetGrouperPrivilegesLiteResult makeWsGetGrouperPrivilegesLiteResult(String groupName, String privilegeName, WsSubjectLookup lookup) {
    WsGetGrouperPrivilegesLiteResult wsGetGrouperPrivilegesLiteResult = new WsGetGrouperPrivilegesLiteResult();
    WsResultMeta wsResultMeta = new WsResultMeta();
    wsResultMeta.setResultCode(FAILURE);
    Person person = personRepository.findByUsername(EVERY_ENTITY);
    Group group = groupRepository.findByPath(groupName);
    Membership membership = membershipRepository.findByPersonAndGroup(person, group);
    boolean enabled = false;
    if (privilegeName.equals(PRIVILEGE_OPT_IN)) {
        if (membership.isOptInEnabled()) {
            enabled = true;
        }
    } else if (privilegeName.equals(PRIVILEGE_OPT_OUT)) {
        if (membership.isOptOutEnabled()) {
            enabled = true;
        }
    } else {
        throw new IllegalArgumentException("Privilege Name not acceptable");
    }
    if (enabled) {
        wsResultMeta.setResultCode(SUCCESS_ALLOWED);
    }
    wsGetGrouperPrivilegesLiteResult.setResultMetadata(wsResultMeta);
    return wsGetGrouperPrivilegesLiteResult;
}
Also used : WsGroup(edu.internet2.middleware.grouperClient.ws.beans.WsGroup) Group(edu.hawaii.its.api.type.Group) WsGetGrouperPrivilegesLiteResult(edu.internet2.middleware.grouperClient.ws.beans.WsGetGrouperPrivilegesLiteResult) Membership(edu.hawaii.its.api.type.Membership) WsMembership(edu.internet2.middleware.grouperClient.ws.beans.WsMembership) WsResultMeta(edu.internet2.middleware.grouperClient.ws.beans.WsResultMeta) Person(edu.hawaii.its.api.type.Person)

Aggregations

WsGetGrouperPrivilegesLiteResult (edu.internet2.middleware.grouperClient.ws.beans.WsGetGrouperPrivilegesLiteResult)3 Group (edu.hawaii.its.api.type.Group)1 Membership (edu.hawaii.its.api.type.Membership)1 Person (edu.hawaii.its.api.type.Person)1 WsGroup (edu.internet2.middleware.grouperClient.ws.beans.WsGroup)1 WsMembership (edu.internet2.middleware.grouperClient.ws.beans.WsMembership)1 WsResultMeta (edu.internet2.middleware.grouperClient.ws.beans.WsResultMeta)1 WsSubjectLookup (edu.internet2.middleware.grouperClient.ws.beans.WsSubjectLookup)1