@Test public void testGetPeopleWithMultivaluedAttributes() { Set<IPersonAttributes> attributes = impersonationStatusPersonAttributeDao.getPeopleWithMultivaluedAttributes(query); assertNotNull(attributes); IPersonAttributes personAttributes = attributes.iterator().next(); String uname = personAttributes.getName(); Map<String, List<Object>> arg1 = personAttributes.getAttributes(); assertNotNull(uname); assertEquals(uname, "UserId"); assertTrue(arg1.containsKey("impersonating")); List<Object> attrs = arg1.get("impersonating"); assertEquals(attrs.get(0), "true"); }
@Override public Set<IPersonAttributes> getPeopleWithMultivaluedAttributes( Map<String, List<Object>> query) { 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; }
ImpersonationStatusPersonAttributeDao extends AbstractDefaultAttributePersonAttributeDao { @Override public Set<IPersonAttributes> getPeopleWithMultivaluedAttributes( Map<String, List<Object>> query) { 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; } }
ImpersonationStatusPersonAttributeDao extends AbstractDefaultAttributePersonAttributeDao { @Override public Set<IPersonAttributes> getPeopleWithMultivaluedAttributes( Map<String, List<Object>> query) { 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; }  }
ImpersonationStatusPersonAttributeDao extends AbstractDefaultAttributePersonAttributeDao { @Override public Set<IPersonAttributes> getPeopleWithMultivaluedAttributes( Map<String, List<Object>> query) { 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; }  @Override Set<String> getAvailableQueryAttributes(); @Override Set<IPersonAttributes> getPeopleWithMultivaluedAttributes(
            Map<String, List<Object>> query); @Override Set<String> getPossibleUserAttributeNames(); }
ImpersonationStatusPersonAttributeDao extends AbstractDefaultAttributePersonAttributeDao { @Override public Set<IPersonAttributes> getPeopleWithMultivaluedAttributes( Map<String, List<Object>> query) { 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; }  @Override Set<String> getAvailableQueryAttributes(); @Override Set<IPersonAttributes> getPeopleWithMultivaluedAttributes(
            Map<String, List<Object>> query); @Override Set<String> getPossibleUserAttributeNames();  }