Saturday, June 11, 2016

Menu Item  Enable/Disable



In the name of Allah, Most Gracious, Most Merciful
Praise be to Allah, blessing and peace be upon our prophet Mohammed, his family and his companions. After that,

One of the greatest tasks an Oracle  developer should learn is Menu Security.
Your application has a certain amount of security by default, because only users with access privileges to the database schema that is used can access the application.

      Once the users and roles are created in the database, then you must grant these roles to the application developers or  users.
  Developer can assign those roles to the security role properties of the  menu module or menu items.


Task Definition:   


Enable/Disable a Menu Item



Task Solution:

We can use Toggle_Enabled  procedure . This is a ready made procedure existing in almost all Oracle forms versions On Line Help. You can look for it  under GET_MENU_ITEM_PROPERTY Built-in.

PROCEDURE Toggle_Enabled (menuitem_name VARCHAR2)
IS
   mi_id   MenuItem;
BEGIN
   mi_id := FIND_MENU_ITEM (menuitem_name);

   IF GET_MENU_ITEM_PROPERTY (mi_id, ENABLED) = 'TRUE'
   THEN
      SET_MENU_ITEM_PROPERTY (mi_id, ENABLED, PROPERTY_FALSE);
   ELSE
      SET_MENU_ITEM_PROPERTY (mi_id, ENABLED, PROPERTY_TRUE);
   END IF;
END;

SET_MENU_ITEM_PROPERTY Restrictions :

Note the following  restrictions apply only if the menu module's Use :
Security property is set to Yes

·        Once the menu module Use Security property is Yes, you can use the SET_MENU_ITEM_PROPERTY  if  the form operator has access privileges for that item.
·         You cannot set the property of a menu item using SET_MENU_ITEM_PROPERTY if the item is currently hidden.
·         If the menu item is displayed w/o Privileges, but disabled Oracle Forms  Run form displays the item in a disabled state. In this case, you can set the menu item properties pro-grammatically.

This creates the overall  access controls  to  any user to any part of the menu application .


 Learn more about:


·          Dependent Drop Down list


Hope this helps...

My success only comes from Allah, pls. note your comments and suggestions are great help for me in progress thanks in advance.



2 comments :

M. Faramawy said...

Thanks & Gazakom Allahu Khairan.
Please attach an example as it does not work.

Neveen Ebraheem said...

Pls try again, i complied the code successfully.
Sometimes the oracle form On-Line help has an unseen characters u can remove it by pressing backspace and rewrite the code on each word that has a compilation error.