Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagexml
titleuportal-war/src/main/resources/properties/context/personDirectoryContext.xml
 ...
<bean id="mergedPersonAttributeDao"
   <property name="personAttributeDaos">
       <list>
...
           <!-- ADDITIONAL ATTRIBUTE SOURCES GET ADDED HERE
           Don't add more sources to the CascadingPersonAttributeDao.personAttributeDaos
           list above unless you're adding "special" DAOs tasked with augmenting/transforming
           the attributes generated by uP-local DAOs. (CascadingPersonAttributeDao takes
           the results from the first-DAO, transforms them into a query, and passes that
           query to each subsequent DAO. I.e. subsequent DAOs in the cascade list will
           *not* be given a chance to process the original query. But they will if you add
           them directly to the MergingPersonAttributeDaoImpl.personAttributeDaos list here.)
           -->
           <ref bean="myJdbcGroupSource"/>
       </list>
   </property>
...
</bean>

<!--
 | Looks in the MY_GROUP table for user-groupname associations and adds to myGroups attribute.  A user can be
 | associated to multiple groups. Results are cached by the outer caching DAO.  Will need to modify ehcache.xml
 | to add a cache name of 'org.jasig.services.persondir.USER_INFO.myJdbcGroupSource'.
 +-->
<bean id="myJdbcGroupSource"
      class="org.jasig.services.persondir.support.CachingPersonAttributeDaoImpl">
    <property name="usernameAttributeProvider" ref="usernameAttributeProvider" />
    <property name="cacheNullResults" value="true" />
    <property name="userInfoCache">
        <bean class="org.jasig.portal.utils.cache.MapCacheFactoryBean">
            <property name="cacheFactory" ref="cacheFactory" />
            <property name="cacheName" value="org.jasig.services.persondir.USER_INFO.myJdbcGroupSource" />
        </bean>
    </property>
    <property name="cacheKeyGenerator" ref="userAttributeCacheKeyGenerator" />
    <property name="cachedPersonAttributesDao" >
        <bean class="org.jasig.services.persondir.support.jdbc.NamedParameterJdbcPersonAttributeDao">
            <property name="dataSource" ref="PersonDB" />
            <property name="sql">
                <value>
                    SELECT groupName AS myDBGroup
                    from MY_GROUPS
                    where UPPER(username) = UPPER(:username)
                </value>
            </property>
            <property name="usernameAttributeProvider" ref="usernameAttributeProvider" />
            <property name="userAttributeNames">
                <set>
                    <value>myDBGroup</value>  <!-- Attribute name added to user -->
                </set>
            </property>
        </bean>
    </property>
</bean>

...