Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to Change this Codes to handle multiple roles?

Inês ToméMar 27 2024 — edited Mar 27 2024

Hello

I have 2 codes of pl/sql that add and edit users and assign them to roles.

However I don't know how to modify this codes to make the app accept more than one role.

This is my ADD_USER

begin

APEX_CUSTOM_AUTH.SET_USER(:P7_USER_NAME);

APEX_ACL.ADD_USER_ROLE (
p_application_id => 100,
p_user_name => :P7_USER_NAME,
p_role_static_id => :P7_USER_ROLE
);
end;

This is my EDIT_USER

DECLARE

l_as_user_any_role BOOLEAN := false;

BEGIN

l_as_user_any_role := APEX_ACL.HAS_USER_ANY_ROLES (
p_application_id => 100,
p_user_name => :P7_USER_NAME);

if l_as_user_any_role then

APEX_ACL.REPLACE_USER_ROLES (
p_application_id => 100,
p_user_name => :P7_USER_NAME,
p_role_static_ids => wwv_flow_t_varchar2( :P7_USER_ROLE) );

end if;
end;

Now the issues

1 - I can add, and edit a user if he only has 1 role. Working fine.

2 - I cannot add or edit a user if I try to assign the user multiple roles.

Here is the error

Translating: No data was found.

Can anyone help correct my codes?

Comments
Post Details
Added on Mar 27 2024
3 comments
368 views