use of org.jasig.services.persondir.support.CaseInsensitiveNamedPersonImpl in project uPortal by Jasig.
the class ImpersonationStatusPersonAttributeDao method getPeopleWithMultivaluedAttributes.
@Override
public Set<IPersonAttributes> getPeopleWithMultivaluedAttributes(Map<String, List<Object>> query) {
// default (per spec?)
Set<IPersonAttributes> rslt = null;
if (this.logger.isDebugEnabled()) {
this.logger.debug("invoking getPeopleWithMultivaluedAttributes(" + query + ")");
}
final IUsernameAttributeProvider usernameAttributeProvider = super.getUsernameAttributeProvider();
final String queryUid = usernameAttributeProvider.getUsernameFromQuery(query);
if (queryUid == null) {
this.logger.debug("No username attribute found in query, returning null");
} else {
final HttpServletRequest req = portalRequestUtils.getCurrentPortalRequest();
final IPerson person = personManager.getPerson(req);
final String currentUid = person.getUserName();
if (currentUid.equals(queryUid)) {
final String value = identitySwapperManager.isImpersonating(req) ? "true" : "false";
if (this.logger.isDebugEnabled()) {
this.logger.debug("Gathering attributes for the current user [" + currentUid + "]; impersonating=" + value);
}
final List<Object> values = Collections.singletonList((Object) value);
final Map<String, List<Object>> attrs = Collections.singletonMap(IMPERSONATING_ATTRIBUTE_NAME, values);
final IPersonAttributes ipa = new CaseInsensitiveNamedPersonImpl(currentUid, attrs);
rslt = Collections.singleton(ipa);
}
}
return rslt;
}
Aggregations