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);
}
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;
}
Aggregations