I am developing in Apex, with custom authentication and using the apex builtin acl (access control list).
My custom authentication is working fine. Regards the authorization:
1 - Create a new user and add a role is working fine. 2 - Now I want to create a process in the login page to get the role of the user and set if it is authorized or not. 3 - I am using the code below but I get the error below.
Can you help me understand what is wrong with this syntax?
I am starting to feel desperate on this.
declare
l_is_admin BOOLEAN :=false;
function "APEX_AUTHORIZATION.IS_AUTHORIZED"(
p_authorization_name IN VARCHAR2 )
RETURN BOOLEAN;
begin
l_is_admin := apex_acl.has_user_role (
p_application_id => 100,
p_user_name => :P9999_USERNAME,
p_role_static_id => ('ADMINISTRATOR')
);
if l_is_admin then
apex_authorization.is_authorized (
p_authorization_name => 'Administration Rights' )
return true;
end if;
end;
this the error: ORA-06550: line 20, column 1: PLS-00103: Encountered the symbol "RETURN" when expecting one of the following: := . ( % ;
If using the builtin roles and authorization schemes, without the code above, even though I have a user that is an administrator, when I try to open a page with the Administration Rights, it shows the error: User is not an Administrator.
This user is present in the tables: APEX_APPL_ACL_USERS, APEX_APPL_ACL_USER_ROLES
Why doesn't this work?
Bunch of syntax errors prevent that code from compiling, such as
declareis superfluous alltogether; variable should be declared within function codetrueonly, but - what if l_is_admin is false? Function won't return anything.I'm not saying that this code will work as you want it to, but it should - at least - compile (if calls of Apex built-ins is correct).