Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

  • Let's now dissect the "Student" fragment below to get an idea of how this works.  The name of the fragment is Student and the fragment is owned by the user account student-lo. What we want to do is push this fragment to our Students group and to do this we define our audience using the GroupMembershipEvaluatorFactory . GroupMembershipEvaluatorFactory evaluates group memberships and with the <paren> and <attribute> directives we specify the group we wish to target. So we will interpret the syntax below as find everyone who is a memberOf the Students group and push this fragment to them.
    Code Block
    xml
    xml
    <dlm:fragment name='Student' ownerID='student-lo' precedence='50'>
        <dlm:audience evaluatorFactory='org.jasig.portal.layout.dlm.providers.GroupMembershipEvaluatorFactory'>
          <paren mode="OR">
            <attribute mode='memberOf' name='Students'/>
          </paren>
        </dlm:audience>
      </dlm:fragment>
    
  • What if we want to push the fragment to more than one group? What if we wanted to push the fragment to Students OR Faculty? We can do this by using the <paren> directive's mode attributes OR, NOT, or AND.
    • Here are some examples of using <paren> and <attribute> together to target specific groups:
      Code Block
      xml
      xml
      
      <!-- Push this fragment to anyone who is a member of the Students OR Faculty group -->
      <dlm:audience evaluatorFactory='org.jasig.portal.layout.dlm.providers.GroupMembershipEvaluatorFactory'>
          <paren mode="OR">
            <attribute mode='memberOf' name='Students'/>
            <attribute mode='memberOf' name='Faculty'/>
          </paren>
        </dlm:audience>
      
      Code Block
      xml
      xml
      <!-- Push this fragment to members of the Students group who are NOT also members of the Faculty group -->
      <dlm:audience evaluatorFactory='org.jasig.portal.layout.dlm.providers.GroupMembershipEvaluatorFactory'>
          <paren mode="AND">
            <attribute mode='memberOf' name='Students'/>
            <paren mode="NOT">
              <attribute mode='memberOf' name='Faculty'/>
            </paren>
          </paren>
        </dlm:audience>
      
    • So as you can see from the above examples there is some flexibility to targeting specific groups of interest.

...

  • Let's imagine that we want to setup a fragment named "Library". This library fragment will contain all information about library services that we wish to send out to only Faculty OR Student groups but NOT Staff groups. Here's what we would do:
  • Define our new fragment as follows in the dlm.xml file
Code Block
xml
xml
<dlm:fragment name='Library' ownerID='library-lo' precedence='40'>
    <dlm:audience evaluatorFactory='org.jasig.portal.layout.dlm.providers.GroupMembershipEvaluatorFactory'>
      <paren mode="OR">
        <attribute mode='memberOf' name='Students'/>          <attribute mode='memberOf' name='Faculty'/>                  
        <paren mode="NOT">
          <attribute mode='memberOf' name='Staff'/>
        </paren>
      </paren>
    </dlm:audience>
  </dlm:fragment>
  • Setting the precedence attribute
    • Each fragment must also declare an integer precedence value. This value is used during merging of fragments to position elements contributed from different fragments. It is also used to determine which precedence elements can override a lower precedence.

                 

Step 3: Deploy your new fragment

...

Now that we have created our new fragment we need to restart uPortal tomcat to activate the new fragment.

No Format
$TOMCAT_HOME/bin/shutdown.sh
$TOMCAT_HOME/bin/startup.sh

Step 5: Setup our new fragment user account

...

  • From your uPortal source directory create the new account by issuing the following command from the command-line:
    No Format
    ant md5passwd -Dusername=library-lo
    
  • You will be prompted to enter a password for the new account
    No Format
    Buildfile: build.xml
    
    prodPrompt:
    
    md5passwd:
    
    install-parent-pom:
    [artifact:install] [INFO] Installing /portal/uPortal-3.2.2/pom.xml to /root/.m2/repository/org/jasig/portal/uportal-parent/3.2.2/uportal-parent-3.2.2.pom
        [touch] Creating /tmp/jasig/uportal-parent.pom-1617936594-marker
         [echo] Artifact '/portal/uPortal-3.2.2/uportal-impl/target/uportal-impl-3.2.2.jar' is up-to-date
    [artifact:install] [INFO] Installing /portal/uPortal-3.2.2/uportal-impl/target/uportal-impl-3.2.2.jar to /root/.m2/repository/org/jasig/...
         [java] Working directory ignored when same JVM is used.
         [java] log4j:WARN No appenders could be found for logger (org.jasig.portal.spring.locator.PortalDbLocator).
         [java] log4j:WARN Please initialize the log4j system properly.
         [java] Enter Password for library-lo:
    
  • Once you enter a password you should receive the success message
    No Format
    ...
    [java] Password Updated...
    
    BUILD SUCCESSFUL
    Total time: 34 seconds
    
  • Now login to uPortal as an administrator and you will automatically receive the library-lo account in the Password Management portlet (see image below)

...