Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UP-5005: AdHocGroupTester uses GroupService.SearchMethod.CONTAINS wh… #1146

Merged
merged 1 commit into from Mar 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -109,7 +109,7 @@ public boolean test(IPerson person) {
rslt,
person.getUserName(),
isNotTest ? "is not" : "is",
groupName);
entityGroup.getName());
return rslt;
}

Expand Down Expand Up @@ -141,7 +141,7 @@ private static String calcGroupHash(String groupName, boolean isNotTest) {
private static IEntityGroup findGroupByName(String groupName) {
EntityIdentifier[] identifiers =
GroupService.searchForGroups(
groupName, GroupService.SearchMethod.CONTAINS, IPerson.class);
groupName, GroupService.SearchMethod.DISCRETE, IPerson.class);
for (EntityIdentifier entityIdentifier : identifiers) {
if (entityIdentifier.getType().equals(IEntityGroup.class)) {
return GroupService.findGroup(entityIdentifier.getKey());
Expand Down
Expand Up @@ -26,8 +26,6 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang.Validate;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apereo.portal.EntityIdentifier;
import org.apereo.portal.groups.IEntityGroup;
import org.apereo.portal.groups.IGroupMember;
Expand All @@ -37,6 +35,8 @@
import org.apereo.portal.user.IUserInstance;
import org.apereo.portal.user.IUserInstanceManager;
import org.apereo.portal.utils.web.AbstractHttpServletRequestWrapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* Portal wide request wrapper. Provides portal specific information for request parameters,
Expand All @@ -56,7 +56,7 @@ public class PortalHttpServletRequestWrapper extends AbstractHttpServletRequestW
public static final String ATTRIBUTE__HTTP_SERVLET_RESPONSE =
PortalHttpServletRequestWrapper.class.getName() + ".PORTAL_HTTP_SERVLET_RESPONSE";

protected final Log logger = LogFactory.getLog(this.getClass());
protected final Logger logger = LoggerFactory.getLogger(getClass());

private final Map<String, String> additionalHeaders = new LinkedHashMap<>();
private final HttpServletResponse httpServletResponse;
Expand Down Expand Up @@ -248,7 +248,14 @@ public boolean isUserInRole(String role) {
final EntityIdentifier personEntityId = person.getEntityIdentifier();
final IGroupMember personGroupMember = GroupService.getGroupMember(personEntityId);

return personGroupMember.isDeepMemberOf(groupForRole);
final boolean rslt = personGroupMember.isDeepMemberOf(groupForRole);
logger.trace(
"Answering {} for isUserInRole where user='{}', role='{}', and groupForRole='{}'",
rslt,
person.getUserName(),
role,
groupForRole.getName());
return rslt;
}

/* (non-Javadoc)
Expand Down