in Oracle Apex i want to redirect users to their specific pages after login as per their user types. please help how i can do this. currently tried on Page 1 (Home) -> Before Header - Branches - Function Returning a URL (Redirect) and my code is as below (to check i hard coded page no. in url's)
declare
x number:=1;
myurl varchar2(255);
begin
if :SESSION_USER_TYPE in ('admin', 'zoneadmin') then
x := 1;
myurl := 'f?p=&APP_ID.:1:&SESSION.::::P1_ID:&SESSION_USER_ID.';
elsif :SESSION_USER_TYPE in ('rider') then
x := 24;
myurl := 'f?p=&APP_ID.:24:&SESSION.::::P24_ID:&SESSION_USER_ID.';
end if;
return myurl;
end;
after login, google says: 127.0.0.1 redirected you too many times. try clearing your cookies ERR_TOO_MANY_REDIRECTS
even i removed all chrome cookies from settings. please help to overcome the situation.
CodePudding user response:
Does your application have deep linking enabled ? If this is disabled then the user will always be redirected to the home page, even if you pass a page in the url. That would explain the too many redirects.
Also, you should remove the block to redirect to page 1. The user is on page 1 so this will get you in an endless loop. An easier solution would be to create a branch (Function Returning a URL (Redirect)) with code
declare
x number:=1;
myurl varchar2(255);
begin
x := 24;
myurl := 'f?p=&APP_ID.:24:&SESSION.::::P24_ID:&SESSION_USER_ID.';
return myurl;
end;
and serverside condition of type "Expression" with code
:SESSION_USER_TYPE in ('rider')
