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