Retrieving Object Privileges Oracle Fusion Middleware Online Documentation Library

15-4 Oracle Fusion Middleware Developers Guide for Oracle Portal end; These two APIs take the following parameters: ■ p_group_id is the ID of the group to which you want to grant privileges set_ group_acl only ■ p_person_id is the ID of the user to whom you want to grant privileges set_ user_acl only ■ p_object_type_name is type of the object on which you want to grant privileges. Use the predefined constants in the WWSEC_API package to specify the value of this parameter, for example wwsec_api.PAGE_OBJ. ■ p_name is the reference to the object. Use the format page group IDpage ID, for example 3317623. ■ p_privilege is the level of privilege you want to grant to the user or group. Use the predefined constants in the WWSEC_API package to specify the value of this parameter, for example wwsec_api.VIEW_PRIV.

15.2.2 Removing Page Level Privileges

At some point, it may become necessary to remove a user or groups privileges from a page. Example 15–5 shows how to use the remove_group_acl API to remove a groups privileges. Example 15–6 shows how to use the remove_user_acl API to remove a users privileges. Example 15–5 Removing Page Privileges from a Group remove_group_acl API declare l_group_id number := wwsec_api.group_idMYGROUP; l_name varchar260 := 3317623; BEGIN wwsec_api.remove_group_acl p_object_type_name = wwsec_api.PAGE_OBJ, p_name = l_name, p_group_id = l_group_id, p_privilege = wwsec_api.MANAGE_PRIV ; end; Example 15–6 Removing Page Privileges from a User remove_user_acl API declare l_person_id number := wwsec_api.idJOHN.SMITH; l_name varchar260 := 3317623; BEGIN wwsec_api.remove_user_acl p_object_type_name = wwsec_api.GROUP_OBJ, p_name = l_name, p_person_id = l_person_id, p_privilege = wwsec_api.MANAGE_PRIV ; end; These two APIs take the following parameters: Implementing Content Security 15-5 ■ p_object_type_name is type of the object from which you want to remove privileges. Use the predefined constants in the WWSEC_API package to specify the value of this parameter, for example wwsec_api.PAGE_OBJ. ■ p_name is the reference to the object. Use the format page group IDpage ID, for example 3317623. ■ p_group_id is the ID of the group whose privileges you want to remove remove_group_acl only. Set this parameter to NULL if you want to remove the specified privilege on this page from all groups. ■ p_person_id is the ID of the user whose privileges you want to remove remove_ user_acl only. Set this parameter to NULL if you want to remove the specified privilege on this page from all users. ■ p_privilege is the level of privilege you want to remove from the user or group. Use the predefined constants in the WWSEC_API package to specify the value of this parameter, for example wwsec_api.VIEW_PRIV. Set this parameter to NULL if you want to remove all privileges on the page from the user or group.

15.3 Setting Item Level Privileges

If item level security ILS is enabled for a page, you can specify access privileges for individual items on the page. Example 15–7 shows how to use the modify_folder API to enable ILS for a page. Example 15–7 Enabling Item Level Security for a Page declare l_page wwsbr_api.page_record; begin select into l_page from schema.wwsbr_user_pages where siteid = 33 and id = 1 and rownum = 1; l_page.haveitemsecurity := 1; wwsbr_api.modify_folder p_page = l_page ; -- Process cache invalidation messages. wwpro_api_invalidation.execute_cache_invalidation; exception ... end; For information about the modify_folder API and WWSBR_USER_PAGES view used in Example 15–7 , refer to Section 11.1, Editing Page Properties . Example 15–8 shows how to enable ILS for an individual item this is the same as selecting Define Item Level Access Privileges in the Oracle Portal user interface: Example 15–8 Enabling Item Level Security for an Item enable_ils_for_item API begin wwsbr_api.enable_ils_for_item p_master_item_id = 453, p_caid = 33, 15-6 Oracle Fusion Middleware Developers Guide for Oracle Portal p_folder_id = 45 ; -- Process cache invalidation messages. wwpro_api_invalidation.execute_cache_invalidation; exception ... end; ■ p_master_item_id is the master ID of the item. You can find this value in the MASTERID column of the WWSBR_ALL_ITEMS view. ■ p_caid is the ID of the page group to which the item belongs. ■ p_folder_id is the ID of the page on which the item appears.

15.3.1 Granting Item Level Privileges

After enabling ILS for the item, you can define access privileges for one or more users or groups. When setting item level privileges, the type of privileges that are granted is dependent on which of the following parameters are passed rather than the parameter values: ■ Pass an array of user IDs to p_itemown_user to grant the Manage privilege to a list of users. ■ Pass an array of user IDs to p_itemmanage_user to grant the Edit privilege to a list of users. ■ Pass an array of user IDs to p_itemview_user to grant the View privilege to a list of users. ■ Pass an array of group IDs to p_itemown_group to grant the Manage privilege to a list of groups. ■ Pass an array of group IDs to p_itemmanage_group to grant the Edit privilege to a list of groups. ■ Pass an array of group IDs to p_itemview_group to grant the View privilege to a list of groups. You can pass values to any combination of these parameters in the same procedure call to set a range of privileges across different users and groups. Example 15–9 shows how you can use the add_item_ils_privileges API to grant item-level privileges to users. Example 15–9 Granting Item Level Privileges to Users add_item_ils_privileges API declare l_itemown_username_array wwsbr_type.array; l_itemown_userid_array wwsbr_type.array; begin l_itemown_username_array1 := jsmith; l_itemown_username_array2 := janesmith; l_itemown_username_array3 := joedoe; Tip: If you want to edit other attributes for the item as well as the ILS setting, you can use the modify_item or modify_item_post_ upload APIs instead. To enable ILS set the p_access_level parameter to wwsbr_api.ITEM_ACCESS, to disable ILS set the parameter to wwsbr_api.FOLDER_ACCESS.