A simple option is to create a function which says whether certain user is end user. For example:
create table users
(username varchar2(30),
user_role varchar2(20)
);
insert into users (username, user_role)
select 'Little', 'Admin' from dual union all
select 'Foot' , 'EndUser' from dual;
create or replace function f_is_end_user (par_app_user in varchar2)
return boolean
is
l_one number(1);
begin
select max(1)
into l_one
from users
where username = par_app_user
and user_role = 'EndUser';
return l_one = 1;
end;
/
Testing:
SQL> begin
2 dbms_output.put_line(case when f_is_end_user('&par_app_user') then 'it is end user'
3 else 'it is NOT end user'
4 end);
5 end;
6 /
Enter value for par_app_user: Little
it is NOT end user
PL/SQL procedure successfully completed.
SQL> /
Enter value for par_app_user: Foot
it is end user
PL/SQL procedure successfully completed.
Create the same function for Admin users.
Now, go to Shared components, Authorization schemes, and create a new scheme:
- name it "end_user"
- type: PL/SQL function returning Boolean
- function body:
return f_is_end_user(:APP_USER);
- error message: "You aren't authorized to do that."
Do the same for "admin" users.
Back to your application. Navigate to page and set its Authorization Scheme.
- for example, if you don't want to let end users view the page, set it to
{Not end_user}
- You can do that for any item as well; if you don't want to let end users use the "Save" button, you'd modify button's "Authorization Scheme" property.
Quite easy, isn't it?