Switched proxy_app logic, app_id is now proxy

This commit is contained in:
Jan Kvetina 2022-01-02 15:47:59 +01:00
parent e80b8ae55e
commit c6b2d9b1b4
6 changed files with 49 additions and 36 deletions

View File

@ -23,7 +23,7 @@ wwv_flow_api.create_page(
,p_page_template_options=>'#DEFAULT#'
,p_required_role=>wwv_flow_api.id(9844735592500475)
,p_last_updated_by=>'DEV'
,p_last_upd_yyyymmddhh24miss=>'20220102123620'
,p_last_upd_yyyymmddhh24miss=>'20220102143830'
);
wwv_flow_api.create_page_plug(
p_id=>wwv_flow_api.id(9264299805429043)
@ -186,6 +186,7 @@ wwv_flow_api.create_page_plug(
,p_plug_display_point=>'BODY'
,p_query_type=>'TABLE'
,p_query_table=>'APPS'
,p_query_where=>'app_id != app.get_core_app_id()'
,p_include_rowid_column=>false
,p_plug_source_type=>'NATIVE_IG'
,p_plug_query_options=>'DERIVED_REPORT_COLUMNS'
@ -608,6 +609,20 @@ wwv_flow_api.create_page_button(
,p_button_redirect_url=>'f?p=&APP_ID.:990:&SESSION.::&DEBUG.:990::'
,p_icon_css_classes=>'fa-refresh'
);
wwv_flow_api.create_page_button(
p_id=>wwv_flow_api.id(12997055906936930)
,p_button_sequence=>10
,p_button_plug_id=>wwv_flow_api.id(9264299805429043)
,p_button_name=>'CLONE_SESSION'
,p_button_action=>'REDIRECT_URL'
,p_button_template_options=>'#DEFAULT#'
,p_button_template_id=>wwv_flow_api.id(9144574670569995)
,p_button_image_alt=>'Clone Session'
,p_button_position=>'RIGHT_OF_TITLE'
,p_button_redirect_url=>'javascript:window.open(''f?p=&APP_ID.:990:&SESSION.: APEX_CLONE_SESSION:NO:1::'', ''_blank'');'
,p_icon_css_classes=>'fa-window-new'
,p_button_cattributes=>'target="_blank"'
);
wwv_flow_api.create_page_item(
p_id=>wwv_flow_api.id(9519736699540350)
,p_name=>'P990_USER_ID'
@ -781,7 +796,7 @@ wwv_flow_api.create_page_computation(
,p_computation_point=>'BEFORE_BOX_BODY'
,p_computation_type=>'EXPRESSION'
,p_computation_language=>'PLSQL'
,p_computation=>'app.get_proxy_app_id()'
,p_computation=>'app.get_app_id()'
);
wwv_flow_api.create_page_da_event(
p_id=>wwv_flow_api.id(12996704930936927)
@ -838,10 +853,10 @@ wwv_flow_api.create_page_process(
,p_process_point=>'AFTER_SUBMIT'
,p_region_id=>wwv_flow_api.id(12995058195936910)
,p_process_type=>'NATIVE_IG_DML'
,p_process_name=>'Applications - Save Interactive Grid Data'
,p_process_name=>'SAVE_APPLICATIONS'
,p_attribute_01=>'REGION_SOURCE'
,p_attribute_05=>'Y'
,p_attribute_06=>'Y'
,p_attribute_06=>'N'
,p_attribute_08=>'Y'
,p_error_display_location=>'INLINE_IN_NOTIFICATION'
);

View File

@ -107,7 +107,7 @@ CREATE OR REPLACE PACKAGE app AS
--
--
-- Returns APEX application id
-- Returns APEX application id (for proxy app)
--
FUNCTION get_app_id
RETURN sessions.app_id%TYPE;
@ -115,9 +115,9 @@ CREATE OR REPLACE PACKAGE app AS
--
-- When using multiple apps in same workspace/schema return previous app
-- When using multiple apps in same workspace/schema return the real application id
--
FUNCTION get_proxy_app_id
FUNCTION get_real_app_id
RETURN sessions.app_id%TYPE;

View File

@ -21,30 +21,25 @@ CREATE OR REPLACE PACKAGE BODY app AS
FUNCTION get_app_id
RETURN sessions.app_id%TYPE
AS
out_app_id sessions.app_id%TYPE;
BEGIN
RETURN COALESCE(APEX_APPLICATION.G_FLOW_ID, 0);
IF APEX_APPLICATION.G_FLOW_ID = app.get_core_app_id() THEN
SELECT MIN(s.app_id) KEEP (DENSE_RANK FIRST ORDER BY s.updated_at DESC) INTO out_app_id
FROM sessions s
WHERE s.session_id = app.get_session_id()
AND s.app_id != app.get_core_app_id();
END IF;
--
RETURN COALESCE(out_app_id, APEX_APPLICATION.G_FLOW_ID, 0);
END;
FUNCTION get_proxy_app_id
FUNCTION get_real_app_id
RETURN sessions.app_id%TYPE
AS
out_app_id sessions.app_id%TYPE;
BEGIN
--IF app.get_app_id() = app.get_core_app_id() THEN
-- RETURN NULL;
--END IF;
--
SELECT MIN(s.app_id) KEEP (DENSE_RANK FIRST ORDER BY s.updated_at DESC) INTO out_app_id
FROM sessions s
WHERE s.session_id = app.get_session_id()
AND s.app_id != app.get_app_id();
--
RETURN out_app_id;
EXCEPTION
WHEN NO_DATA_FOUND THEN
RETURN NULL;
RETURN COALESCE(APEX_APPLICATION.G_FLOW_ID, 0);
END;

View File

@ -3,9 +3,8 @@ WITH x AS (
SELECT
app.get_item('$PAGE_ID') AS filter_page_id,
app.get_page_id() AS page_id,
app.get_core_app_id() AS core_app_id,
--
COALESCE(CASE WHEN app.get_app_id() = app.get_core_app_id() THEN app.get_proxy_app_id() END, app.get_app_id()) AS app_id
app.get_app_id() AS app_id,
app.get_core_app_id() AS core_app_id
FROM users u
WHERE u.user_id = app.get_user_id()
),
@ -13,12 +12,15 @@ t AS (
SELECT
n.app_id,
n.page_id,
--
REPLACE(p.page_name, '&' || 'APP_NAME.', a.application_name) AS page_name,
REPLACE(p.page_title, '&' || 'APP_NAME.', a.application_name) AS page_title,
--
p.page_alias,
p.page_group,
p.authorization_scheme,
p.page_css_classes,
--
LEVEL - 1 AS depth,
CONNECT_BY_ROOT NVL(n.order#, n.page_id) AS page_root
FROM navigation n
@ -81,7 +83,7 @@ SELECT
--
app.get_page_link (
in_page_id => x.page_id,
in_app_id => n.app_id,
in_app_id => x.core_app_id,
in_names => 'P' || TO_CHAR(x.page_id) || '_REMOVE_PAGE',
in_values => TO_CHAR(n.page_id)
) AS action_url
@ -102,7 +104,7 @@ WHERE (x.filter_page_id = n.page_id OR x.filter_page_id IS NULL)
-- if page from CORE has same page number in current app, then skip it
SELECT n.page_id
FROM navigation n
WHERE n.app_id = x.app_id
WHERE n.app_id = x.app_id
)
)
)
@ -145,7 +147,7 @@ SELECT
--
app.get_page_link (
in_page_id => x.page_id,
in_app_id => n.app_id,
in_app_id => x.core_app_id,
in_names => 'P' || TO_CHAR(x.page_id) || '_ADD_PAGE',
in_values => TO_CHAR(n.page_id)
) AS action_url

View File

@ -2,8 +2,8 @@ CREATE OR REPLACE VIEW roles_cards AS
WITH x AS (
SELECT
u.user_id,
COALESCE(app.get_proxy_app_id(), app.get_app_id()) AS app_id,
app.is_developer_y() AS is_developer
app.get_app_id() AS app_id,
app.is_developer_y() AS is_developer
FROM users u
WHERE u.user_id = app.get_user_id()
)

View File

@ -12,14 +12,15 @@ SELECT
--in_session_id =>
) AS app_url,
--
CASE WHEN a.app_id = app.get_proxy_app_id() THEN 'fa-anchor' END AS app_icon
NULL AS app_icon
FROM apps a
WHERE (
a.is_visible = 'Y'
WHERE a.is_active = 'Y'
AND a.app_id != app.get_core_app_id()
AND (
a.is_visible = 'Y'
OR a.app_id IN (
SELECT r.app_id
FROM user_roles r
WHERE r.user_id = app.get_user_id()
)
)
AND a.is_active = 'Y';
);