Retrieving Parameter Values Using Parameters

8-26 Oracle Fusion Middleware Developers Guide for Oracle Portal

8.6.2 Using wwctx_api to Obtain Context Information

The services example, located in ..\pdkplsql\pdk\plsql\svcex in PDK-PLSQL pdkplsql.zip, illustrates how you can obtain session information using the wwwctx_api package. You can browse through this example as follows to see how the function calls are implemented in a portlet:

1. Open the services_portlet.pkb file in an editor.

2. Find the get_portlet_info function.

3. Notice the usage of wwctx_api.get_user to derive the user information and set

that value in the portlet information record: ... l_portlet.timeout := null; l_portlet.timeout_msg := null; l_portlet.created_on := to_date10192000, MMDDYYYY; l_portlet.created_by := wwctx_api.get_user; l_portlet.last_updated_on := to_date10192000, MMDDYYYY; l_portlet.last_updated_by := wwctx_api.get_user; l_portlet.has_show_edit_defaults := true; l_portlet.has_show_preview := true; l_portlet.preference_store_path := PORTLET_PATH; ...

4. wwctx_api.get_user is used similarly in various places throughout

services_portlet.pkb. Search the code for other occurrences of wwctx_ api.get_user.

5. Another example of getting context information occurs in the is_runnable

function: function is_runnable p_provider_id in integer ,p_reference_path in varchar2 Note: For more information on the context APIs, see the PLSQL API Reference. The API Reference can be found on Portal Center http:portalcenter.oracle.com or, if you downloaded PDK-PLSQL pdkplsql.zip, in ..\pdkplsql\pdk\plsql\doc. Table 8–5 Context Information Function Calls Session Information Function Call Current user wwctx_api.get_user Login status of user wwctx_api.is_logged_on Login time wwctx_api.get_login_time Language wwctx_api.get_nls_language Current session id wwctx_api.get_sessionid IP address of user client wwctx_api.get_ip_address User schema wwctx_api.get_db_user Oracle Portal schema wwctx_api.get_product_schema Oracle Portal version wwctx_api.get_product_version Creating PLSQL Portlets 8-27 return boolean is begin -- -- Portlet security check. It allows the portlet to be visible -- if the user is logged on, that is, the current session is not a -- public session. -- return wwctx_api.is_logged_on; end is_runnable; 6. In the register procedure, wwctx_api.get_nls_language is used to get the language: -- -- Create the names to store the portlet preferences. -- wwpre_api_name.create_name p_path = PORTLET_PATH || p_portlet_instance.reference_path, p_name = PREFNAME_STRING, p_description = Single custom row in || Introductory Example portlet., p_type_name = NLSID, p_language = wwctx_api.get_nls_language; wwpre_api_name.create_name p_path = PORTLET_PATH || p_portlet_instance.reference_path, p_name = PREFNAME_TITLE, p_description = Single custom row in || Introductory Example portlet., p_type_name = NLSID, p_language = wwctx_api.get_nls_language; 7. Close services_portlet.pkb. You can implement session context similarly but based upon your own functional requirements. 8. Optionally, if you want to see this portlet on a page and it is not already in the Portlet Repository, refer to the instructions in Section 8.3.2, Implementing the Provider Package for information on how to add it. 9. Once your portlet appears in the repository, you can add it to a page to test it. To add your portlet to a page, follow the instructions in Oracle Fusion Middleware Users Guide for Oracle Portal.

8.7 Implementing Portlet Security

Portlet security refers to the techniques and methods used by portlets to control their access by end users. The portlets leave authentication to Oracle Portal and trust that the portal will return them to the correct, validated user upon request. Oracle Portal strictly controls access to information and applications by assigning specific privileges to users and groups. Portal security services allow you to specify access control programmatically and check for the appropriate privileges at runtime. Security mechanisms used by portlets ensure that only authorized users gain access to these portlets. These security services are available through the wwsec_api package.