Showing posts with label PortalScriptingInterface. Show all posts
Showing posts with label PortalScriptingInterface. Show all posts
One of the common uses of portal scripting interface is to use it for controlling access control. The Portal Scripting interface provides two different beans that allows you to manipulate the access control.
Lets say you want to modify the access control for "Test Page" page(Unique name for page is testpage). If thats the case then you should follow this procedure

  1. Load the access control object for this page using

    set acl [$Access getacl Content [$Content find page uniquename testpage]]

    This will load all the access control information for this is acl object.

  2. Once the access information for a resource is loaded in acl bean then you can decide if you want to either only view the information or edit the information. In our case since we want to edit the page information call

    $PacList edit $acl


  3. In the next step we can actual grant or revoke of the user role.
    Ex.
    $PacList grant User special Authenticated

    This will assign All authenticated users User role on the page
    $PacList revoke PrivilegedUser special Authenticated

    This will remove Privileged Usre role for all authenticated users on this page.
    $PacList grant Editor name "johndoe"

    This will assign Editor role to John Doe on this page

  4. Once your done manipulating the access control information then you can commit your changes by calling
    $PacList done

    This command would write back your changes in Portal Access Control

Portal Scripting Interface Beans

The portal scripting component introduces so-called script beans into the JACL language. These are objects with methods that work on portal data. There is no JACL object that represent particular page or portlet. Rather, there is a fixed number of script beans that provide access to a specific areas of the portal data.

The available beans are

  • Portal: The Portal bean is used for performing portal level operations such as login and logout. As well as setting the virtual portal for the current session($Portal setvp )

  • Content: The Content bean allows you to interact with portal content hierarchy(Pages, labels, URLs).It allows you to create,update delete, move pages, labels, urls

  • Layout: The Layout bean allows you to work with component hierarchy on a page. Component hierarchy contains horizontal and vertical containers, controls

  • Portlet: The Portlet bean allows you to work with portlet repository which consist of portlets, portlet applications and web modules

  • Look: The Look bean provides access to the portal theme and skin objects

  • Access:The Access bean is for reading, writing of the access control objects

  • PacList: The PacList bean provides operations to view and edit access control objects.

Run scripting command in a profile

A profile is a script that runs before the main script, or before entering interactive mode. Profiles can be used to set up environment specific behavior or user specific data. Profiles are specified when invoking wpscript, using the -profile parameter. For example, the login command can be placed in a profile. The following example of a profile, which can be named mylogin.jacl, would look like this:


set user wpsadmin
set pwd wpsadmin
$Portal login $user $pwd


Then you can execute your jacl script using this command
wpscript.sh -port port_number -profile mylogin.jacl -username wasadmin -password wasadmin -f testme.jacl
As you can see your passing name of your mylogin.jacl as value for -profile command line parameter. So the mylogin.jacl script will get executed before testme.jacl and as a result you dont have to include login command in each of your JACL scripts

Introduction to Portal Scripting Interface

WPS provides a scripting interface that you can use for administering portal from the command line.The portal scripting interface is extension of the WAS Admin Scripting interface.
When you use portal scripting interface unlike the XMLAccess tool, WebSphere Portal is accessed with user identity, not as a "super administrator".

You can use the Portal Scripting interface in two different modes

  • Interaction mode: Use the interactive mode if you want to interact directly and dynamically with the portal to perform simple administrative tasks that should only be executed once. For example, the administrator wants to modify the permissions of a page for a certain principal, or the administrator wants to add a portlet to a page. Use the interactive mode if you do not intend to repeat the operation. Use these steps to use portal scripting in interactive modes

    1. Execute wpscript.sh -port port_number -user admin_userid -password admin_password command. This should open a wsadmin command console

    2. Login into portal using $Portal login wpsadmin wpsadmin command

    3. Execute whatevery wpsadmin commands you want to execute

    4. After you have completed all tasks by the portal scripting interface, close and exit the script processor. All changes that you committed are applied to the portal configuration.



  • Scripting mode: Use the script mode to apply predefined changes to the configuration of a portal. The wpscript tool executes a JACL script that contains the administrative operations. The scripting client inherits the JACL processor from wsadmin, so an administrator can exploit the JACL scripting language, in order to write re-usable, extendable administration scripts. This mode is typically preferred if reproducible administration tasks are created: For example, the administrator can write a JACL script that produces a complete page subtree, and adds individual page layouts and portlets on each page. Follow these steps to use scripting mode

    1. Create a JACL script file containing the administrative commands for the changes that you would like to make

    2. Execute this command wpscript.sh -port port_number -f script_file_name.jacl

    3. Check the output from the script processor to ensure that no errors occurred during the execution of the script.