Objective : The objective of this documentation is to introduce you to an important feature in Portal 6.1 called Attribute Based Administration using external resource collection
Overview : Attribute Based Administration provides a facility to customize the site layout for individual users or groups of users via “Visibility Rules”. Visibility Rules instruct Portal to: Show or hide pages and portlets based on dynamic characteristics that are determined at runtime according to business rules.
Note: All the screenshots are captured from RSAv7.5.4
1) For running this Lab exercise prerequisites are :
a. Portal Server v6.1.0.3 or higher
b. Derby10.1(Network Server) – Derby Client JDBC Driver
c. RSA or RAD v7.0 or higher
2) Start derby database
a. Start derby service using the following command -
${WebSphere_AppServer_HOME)\derby\bin\networkServer\startNetworkServer.bat
3) Create a database and table in derby using RSA/RAD
a. Setting JDBC Driver for Derby10.1 client
i. Open the RSA – ignore if already open
ii. Goto Window-> Preferences (
iii. Expand “Data Management”->”Connectivity” tab then click on “Driver Definitions”
iv. From the list of Database driver name , select “Derby 10.1 – Derby Client JDBC Driver Default” and click on edit button, “Edit Driver Definition” a new window will open
v. Switch to “Jar List” tab
vi. Specify correct JDBC driver jar file for Derby10.1 client Ex - ${WebSphere_AppServer_HOME)\derby\lib\derbyclient.jar By clicking on “Add Jar/Zip” button.
b. Create the database & table required
i. Open the RSA – ignore if already open
ii. Switch to “Database Development” perspective
iii. Define “Database Connections” – Right click on “Database Connections” and chose “New…” option from context menu. Specify database connection parameters similar to below captured screenshot. Password is user
iv. Click on “Test Connection” button to check Derby DB availability. Once db pinged successfully click on Finish button
v. Right click on “pzn_user_resource” database connection and choose “New Sql Script” option
vi. In SQL Script window paste following SQL Scripts to generate sample table and its data
Note: Users_id column must contain the same value for user’s uid attribute that is defined in WPS server user repository Like – LDAP
CREATE TABLE app.USERS ( USER_ID VARCHAR(100) NOT NULL primary key, DEPT_ID INTEGER ); insert into app.users values('uid=wpadmin,o=defaultWIMFileBasedRealm',1); insert into app.users values('uid=shashi,o=defaultWIMFileBasedRealm',2); |
vii. Right click on “SQL Script window” and select “Run SQL” option; it will execute all the sql statement written in SQL editor window. Resultant user’s table will create and be populated with sample data.
4) Create a empty portlet project
a. Open the RSA – ignore if already open
b. Switch to web perspective
c. Create a new empty portlet project and specify filed value similar to below captured screenshot and click on finish button.
5) Create “Content or User Resource”
a. Open the RSA – ignore if already open
b. Select & Right Click on “PZN_demo” portlet project and select “New->Other” option
c. Expand “Portal”->”Personalization” and select “Content or User Resource” and click on next button.
d. Chose “SQL” as a protocol and “Web users” as resource collection as captured in below screenshot. Click on next button.
e. Select “pzn_user_resource” as existing database connection and click on next button
f. The personalization resource wizard opens. On the Tables tab, highlight USERS by single clicking on it. Click the arrow button pointing to the right to select the table. Click Primary Table to mark it as the primary table.
g. Select the Columns tab. On the Columns tab, move all columns to the right by clicking the double arrow button. Notice the primary key is the column User_ID.
h. Click the Mappings tab. On the Mappings tab, select Dept_id and click Populate.
i. Click the Select buttons and expand APP > USERS to select DEPT_ID for the Description and Value fields. Click OK.
j. Click the Deployment tab.
k. On the Deployment tab, change the datasource to jdbc/pzndemo. This datasource is required to define in WAS.
l. Click Next
m. Set the package name as pzndemo. Select Include schema names in the generated Resource Runtime Manager.
n. Click Finish.
You can now see the new JAVA classes in your project:
6) Create a datasource using appserver console
a. Start the portal sever – if not already started
b. Open a browser and type https://localhost:10041/ibm/console and enter logic credentials
c. Define “J2c Authentication Data”
i. Expand "Security" section and click on "Secure administration, applications and infrastructure"
From right side box "Java Authentication and Authorization Service" expand it and click on "J2C authentication data"
ii. Click on New Button
iii. Specify pzndemo_derby as alias, user as user and password as user
iv. Click on apply button, then click on save link
Once you click on save link you will get screen similar to below, newly create “J2c authentication data is listed”
d. Define Derby JDBC provider
i. Expand "Resources">JDBC and click on JDBC Provider
In the JDBC Provider block, select Server as websphere_portal and click on new button
ii. Specify JDBC provider information then click on next button then finish button
iii. Click on Save link
e. Create a databsource with JNDI name “jdbc/pzndemo”
i. Expand "Resources"> "JDBC" click on "Data sources" link
In the Data Sources block, select Server as WebSphere_Portal and click on New Button
ii. Specify datasource name, JNDI name & Component-managed based authentication alias
iii. Click on Next.
iv. Select JDBC Provider just created
v. Click on next
vi. Specify database name “pzn_user_resource” and click on next button then Finish button
vii. Click on save link. Select the newly created Datasource and click on “Test Connection” button. If all setting is correct then you will get following message.
7) Deploy & Import Personalization Workspace resource collections
a. Deploy pzn_demo personalization code
i. Place pzndemo class files into a directory accessible by that portlet. To do this, export the pzndemo folder in RSA under PZN_demo/Java Resources: src as a JAR file. Make the target location PortalServer_root/pzn/prereq.pzn/collections/pzndemo.jar. Accept the defaults and click Finish
b. Restart Portal Server
c. Import Personalization resource collections
i. Login to portal server using admin credentials
ii. Click the Applications>Content>Personalization>Business Rules
iii. In the Personalization Navigator portlet, click New > Folder
iv. Enter the name Pzn demo and click save
v. Change to the Pzn demo folder.
vi. Click Import
vii. Browse to find the Users.hrf file in your {RSA workspace}/PZN_demo/WebContent/WEB-INF/pzn-resourceCollections/pzndemo project directory.
viii. See the resource collection in the Workspace.
8) Create Simple Visibility Rules (We need to display or hide a portlet based on personalized rule)
a. Login to the portal server using admin credentials
b. Click the Applications>Content>Personalization>Business Rules
c. In the Personalization Navigator portlet, Change to the Pzn demo folder
Then click New > Rule
d. Type "PZN_demo Visibility Rule" in the New Rule field.
e. Select “Visibility Rule” from the Rule Type drop-down list.
f. click on “attribute” on the rule editor and select Users -> Dept_id
g. Specify 1 for the value and click submit.
h. Click Save. The completed rule will list like the following example.
9) Apply Personalization Rule to Page or Portlet
a. Open a Web Browser window and browse to http://localhost:10040/wps/portal Login using admin credentials
b. Create a new page under Home ex.“About WebSphere” using portal administration and add some out-of-box portlet like – “About WebSphere Portal”. Move your mouse to the About WebSphere & click on the down arrow icon to open the context menu. Click on “Edit Page Layout”
c. Click on Show Portlet Rule Mappings
d. Click on Select Rule
e. From Personalization Picker select “PZN demo Visibility Rule” rule and click on ok
f. Click Done on the Page Layout Page. Depending on the users dept_id the portlet that was configured with this rule would be visible or not.
*****Lab Files are here
http://www.box.net/shared/b00thbvypqqrazt19hyb
http://www.box.net/shared/r9nyfmccba87nc4ot0sl
http://www.box.net/shared/r9nyfmccba87nc4ot0sl
I have an issue,In step 5f I did not get the table created in previous step.
ReplyDeletecreate a table in any db you having and from RAD/RSA go to 'Database Development' prescriptive then create db connection from there.
ReplyDelete