Logic moved to function
This commit is contained in:
parent
78cbc5e4b5
commit
4511b48b8d
@ -14,12 +14,8 @@ wwv_flow_api.component_begin (
|
||||
wwv_flow_api.create_security_scheme(
|
||||
p_id=>wwv_flow_api.id(9844735592500475)
|
||||
,p_name=>'IS_ACTIVE_USER'
|
||||
,p_scheme_type=>'NATIVE_EXISTS'
|
||||
,p_attribute_01=>wwv_flow_string.join(wwv_flow_t_varchar2(
|
||||
'SELECT 1',
|
||||
'FROM users u',
|
||||
'WHERE u.user_id = app.get_user_id()',
|
||||
' AND u.is_active = ''Y'''))
|
||||
,p_scheme_type=>'NATIVE_FUNCTION_BODY'
|
||||
,p_attribute_01=>'RETURN app.is_active_user();'
|
||||
,p_error_message=>'ACCESS_DENIED'
|
||||
,p_caching=>'BY_USER_BY_PAGE_VIEW'
|
||||
);
|
||||
|
||||
@ -167,6 +167,26 @@ CREATE OR REPLACE PACKAGE app AS
|
||||
|
||||
|
||||
|
||||
--
|
||||
--
|
||||
--
|
||||
FUNCTION is_active_user (
|
||||
in_user_id users.user_id%TYPE := NULL
|
||||
)
|
||||
RETURN BOOLEAN;
|
||||
|
||||
|
||||
|
||||
--
|
||||
--
|
||||
--
|
||||
FUNCTION is_active_user_y (
|
||||
in_user_id users.user_id%TYPE := NULL
|
||||
)
|
||||
RETURN CHAR;
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Check if current/requested user is APEX developer
|
||||
--
|
||||
|
||||
@ -169,6 +169,37 @@ CREATE OR REPLACE PACKAGE BODY app AS
|
||||
|
||||
|
||||
|
||||
FUNCTION is_active_user (
|
||||
in_user_id users.user_id%TYPE := NULL
|
||||
)
|
||||
RETURN BOOLEAN
|
||||
AS
|
||||
is_valid CHAR;
|
||||
BEGIN
|
||||
SELECT 'Y' INTO is_valid
|
||||
FROM users u
|
||||
WHERE u.user_id = COALESCE(in_user_id, app.get_user_id())
|
||||
AND u.is_active = 'Y';
|
||||
--
|
||||
RETURN TRUE;
|
||||
EXCEPTION
|
||||
WHEN NO_DATA_FOUND THEN
|
||||
RETURN FALSE;
|
||||
END;
|
||||
|
||||
|
||||
|
||||
FUNCTION is_active_user_y (
|
||||
in_user_id users.user_id%TYPE := NULL
|
||||
)
|
||||
RETURN CHAR
|
||||
AS
|
||||
BEGIN
|
||||
RETURN CASE WHEN app.is_active_user(in_user_id) THEN 'Y' END;
|
||||
END;
|
||||
|
||||
|
||||
|
||||
FUNCTION is_developer (
|
||||
in_user users.user_login%TYPE := NULL
|
||||
)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user