Search in sources :

Example 1 with WsAssignGrouperPrivilegesLiteResult

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

the class GroupAttributeServiceImpl method assignGrouperPrivilege.

// gives the user the privilege for that group
public GroupingsServiceResult assignGrouperPrivilege(String username, String privilegeName, String groupPath, boolean set) {
    logger.info("assignGrouperPrivilege; username: " + username + "; group: " + groupPath + "; privilegeName: " + privilegeName + " set: " + set + ";");
    WsSubjectLookup lookup = grouperFS.makeWsSubjectLookup(username);
    String action = "set " + privilegeName + " " + set + " for " + username + " in " + groupPath;
    WsAssignGrouperPrivilegesLiteResult grouperPrivilegesLiteResult = grouperFS.makeWsAssignGrouperPrivilegesLiteResult(groupPath, privilegeName, lookup, set);
    return hs.makeGroupingsServiceResult(grouperPrivilegesLiteResult, action);
}
Also used : WsSubjectLookup(edu.internet2.middleware.grouperClient.ws.beans.WsSubjectLookup) WsAssignGrouperPrivilegesLiteResult(edu.internet2.middleware.grouperClient.ws.beans.WsAssignGrouperPrivilegesLiteResult)

Example 2 with WsAssignGrouperPrivilegesLiteResult

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

the class GrouperFactoryServiceImplLocal method makeWsAssignGrouperPrivilegesLiteResult.

@Override
public WsAssignGrouperPrivilegesLiteResult makeWsAssignGrouperPrivilegesLiteResult(String groupName, String privilegeName, WsSubjectLookup lookup, boolean allowed) {
    WsAssignGrouperPrivilegesLiteResult wsAssignGrouperPrivilegsLiteResult = new WsAssignGrouperPrivilegesLiteResult();
    WsResultMeta wsResultMeta = new WsResultMeta();
    wsResultMeta.setResultCode(SUCCESS);
    Person person = personRepository.findByUsername(lookup.getSubjectIdentifier());
    Group group = groupRepository.findByPath(groupName);
    Membership membership = membershipRepository.findByPersonAndGroup(person, group);
    if (privilegeName.equals(PRIVILEGE_OPT_IN)) {
        membership.setOptInEnabled(allowed);
    } else if (privilegeName.equals(PRIVILEGE_OPT_OUT)) {
        membership.setOptOutEnabled(allowed);
    } else {
        throw new IllegalArgumentException("Privilege Name not acceptable");
    }
    wsAssignGrouperPrivilegsLiteResult.setResultMetadata(wsResultMeta);
    return wsAssignGrouperPrivilegsLiteResult;
}
Also used : WsGroup(edu.internet2.middleware.grouperClient.ws.beans.WsGroup) Group(edu.hawaii.its.api.type.Group) WsAssignGrouperPrivilegesLiteResult(edu.internet2.middleware.grouperClient.ws.beans.WsAssignGrouperPrivilegesLiteResult) 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

WsAssignGrouperPrivilegesLiteResult (edu.internet2.middleware.grouperClient.ws.beans.WsAssignGrouperPrivilegesLiteResult)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 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