Versions Compared

Key

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

...

  • the group names do not change frequently
  • you don't have need of group hierarchies (or can use local groups to provide the group hierarchies)
  • You don't need to answer the question 'Who are the members of group X' in uPortal (you can of course get that by querying the database table) because PAGS doesn't support answering that question
  • You don't need hierarchies of groups (or could include groups into uPortal's local groups to accomplish your needs)

you can use the approach of

...

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>

...

Code Block
languagexml
titleentity-based PAGS group: uportal-war/src/main/data/default_entities/pags/myTestGroup.pags-group.xml
<pags-group script="classpath://org/jasig/portal/io/import-pags-group_v4-1.crn">
  <name>My Test Group</name>
  <description>myTestGroup defined in MY_GROUPS table</description>
  <selection-test>
    <test-group>
      <test>
        <attribute-name>myDBGroup</attribute-name>
        <tester-class>org.jasig.portal.groups.pags.testers.RegexTester</tester-class>
        <test-value>myTestGroup</test-value>
      </test>
    </test-group>
  </selection-test>
</pags-group>
 
<!-- Also add My Test Group to PAGS_Root.pags-group.xml -->
Info

Also see Configuring Person Attribute Group Store (PAGS)