Reputation: 205
I am very upset with this oracle apex, their is no proper practical example or demonstration on Oracle Apex
I have built one application where I have 4 pages -> Home , My account , Calculate gross
If my Role : Admin and Name : Raj
… I should have access to all my above pages
If my Role : user and Name : Bob
… I should have access only to page : Home and Calculate gross and remaining pages should be hide
Following is my table details : employee
Name , Age , Role
Raj , 24 , Admin
Bob , 26 , User
Note : I am using SSO login
Upvotes: 0
Views: 1824
Reputation: 142733
You should create authorization schemes - it is done within "Shared components" section. For example, you can create the one whose name is "full_access", its type is "PL/SQL function returning Boolean".
Code depends on what "role" and "name" actually represent; I presume that they are stored into some table. In that case, and if you created Apex users whose username matches name you mentioned (e.g. Raj and Bob), that would be
declare
l_role t_users.role%type;
begin
select t.role
into l_role
from t_users
where name = :APP_USER; --> APP_USER is username of currently logged user
return l_role = 'Admin'; --> if role is "Admin", function would return TRUE
end;
(Feel free to improve it.)
Then go to the page itself, check its (page's) properties - scroll down to the "Security" section and set the "Authorization scheme" property to "full access".
Doing so, any APP_USER
whose role isn't "Admin", won't have access to that page.
Upvotes: 3