From a18272e21d80d673f4ee28ae3cb6e17ef1007d46 Mon Sep 17 00:00:00 2001 From: Jan Kvetina Date: Sat, 25 Dec 2021 23:05:09 +0100 Subject: [PATCH] Renamed (I know) --- views/roles_auth_schemes.sql | 35 +++++++++++++++++++++++++++++++++++ views/users_auth_schemes.sql | 35 ----------------------------------- 2 files changed, 35 insertions(+), 35 deletions(-) create mode 100644 views/roles_auth_schemes.sql diff --git a/views/roles_auth_schemes.sql b/views/roles_auth_schemes.sql new file mode 100644 index 0000000..bacca26 --- /dev/null +++ b/views/roles_auth_schemes.sql @@ -0,0 +1,35 @@ +CREATE OR REPLACE VIEW roles_auth_schemes AS +SELECT + a.authorization_scheme_name AS auth_scheme, + MAX(a.attribute_01) AS auth_source, + -- + MAX(LTRIM(s.object_name || '.' || s.procedure_name, '.')) AS auth_procedure, + -- + NULLIF(COUNT(DISTINCT p.page_id), 0) AS count_pages, + NULLIF(COUNT(DISTINCT g.region_id), 0) AS count_regions, + NULLIF(COUNT(DISTINCT u.user_id), 0) AS count_users, + -- + MAX(CASE WHEN a.caching = 'Once per session' THEN 'Y' END) AS cache_session, + MAX(CASE WHEN a.caching = 'Once per page view' THEN 'Y' END) AS cache_page_view, + MAX(CASE WHEN a.caching = 'BY_COMPONENT' THEN 'Y' END) AS cache_component, + MAX(CASE WHEN a.caching = 'NOCACHE' THEN 'Y' END) AS cache_no, + -- + MAX(a.error_message) AS error_message +FROM apex_application_authorization a +LEFT JOIN apex_application_pages p + ON p.application_id = a.application_id + AND p.authorization_scheme = a.authorization_scheme_name +LEFT JOIN apex_application_page_regions g + ON g.application_id = a.application_id + AND g.authorization_scheme = a.authorization_scheme_name +LEFT JOIN roles r + ON r.role_id = a.authorization_scheme_name +LEFT JOIN user_roles u + ON u.app_id = a.application_id + AND u.role_id = r.role_id +LEFT JOIN user_procedures s + ON s.procedure_name = a.authorization_scheme_name + AND UPPER(a.attribute_01) LIKE '%' || s.object_name || '.' || s.procedure_name || '%' +WHERE a.application_id = app.get_app_id() +GROUP BY a.authorization_scheme_name; + diff --git a/views/users_auth_schemes.sql b/views/users_auth_schemes.sql index b99c2c6..e69de29 100644 --- a/views/users_auth_schemes.sql +++ b/views/users_auth_schemes.sql @@ -1,35 +0,0 @@ -CREATE OR REPLACE VIEW users_auth_schemes AS -SELECT - a.authorization_scheme_name AS auth_scheme, - MAX(a.attribute_01) AS auth_source, - -- - MAX(LTRIM(s.object_name || '.' || s.procedure_name, '.')) AS auth_procedure, - -- - NULLIF(COUNT(DISTINCT p.page_id), 0) AS count_pages, - NULLIF(COUNT(DISTINCT g.region_id), 0) AS count_regions, - NULLIF(COUNT(DISTINCT u.user_id), 0) AS count_users, - -- - MAX(CASE WHEN a.caching = 'Once per session' THEN 'Y' END) AS cache_session, - MAX(CASE WHEN a.caching = 'Once per page view' THEN 'Y' END) AS cache_page_view, - MAX(CASE WHEN a.caching = 'BY_COMPONENT' THEN 'Y' END) AS cache_component, - MAX(CASE WHEN a.caching = 'NOCACHE' THEN 'Y' END) AS cache_no, - -- - MAX(a.error_message) AS error_message -FROM apex_application_authorization a -LEFT JOIN apex_application_pages p - ON p.application_id = a.application_id - AND p.authorization_scheme = a.authorization_scheme_name -LEFT JOIN apex_application_page_regions g - ON g.application_id = a.application_id - AND g.authorization_scheme = a.authorization_scheme_name -LEFT JOIN roles r - ON r.role_id = a.authorization_scheme_name -LEFT JOIN user_roles u - ON u.app_id = a.application_id - AND u.role_id = r.role_id -LEFT JOIN user_procedures s - ON s.procedure_name = a.authorization_scheme_name - AND UPPER(a.attribute_01) LIKE '%' || s.object_name || '.' || s.procedure_name || '%' -WHERE a.application_id = app.get_app_id() -GROUP BY a.authorization_scheme_name; -