Select the correct statement regarding BEQUEATH CURRENT_USER.
A.
If a view references a PL/SQL function then BEQUEATH CURRENT_USER allows the function to execute with DBA privileges, regardless of the invoking users privileges.
B.
The BEQUEATH CURRENT_USER clause allows invoker’s rights functions referenced in a view to execute with the privileges of the invoking user.
C.
Any view calling a PL/SQL function with BEQUEATH CURRENT_USER in effect will execute with the privileges of the function owner.
D.
With the BEQUEATH CURRENT_USER clause, a definer’s rights function referenced in a view executes with the privileges of the view owner, not the function
-- AS USER HR
CREATE OR REPLACE FUNCTION COUNT_ROWS RETURN NUMBER
AUTHID CURRENT_USER
IS
l_count_countries number;
l_count_jobs number;
BEGIN
BEGIN
SELECT COUNT(*) INTO l_count_countries FROM HR.COUNTRIES;
EXCEPTION WHEN OTHERS THEN
l_count_countries := 0;
END;
BEGIN
SELECT COUNT(*) INTO l_count_jobs FROM HR.JOBS;
EXCEPTION WHEN OTHERS THEN
l_count_jobs := 0;
END;
RETURN l_count_countries + l_count_jobs;
END;
/
CREATE OR REPLACE VIEW BEQUEATH_DEFINER_COUNT_ROWS_VIEW BEQUEATH DEFINER AS
SELECT HR.COUNT_ROWS FROM DUAL;
CREATE OR REPLACE VIEW BEQUEATH_INVOKER_COUNT_ROWS_VIEW BEQUEATH CURRENT_USER AS
SELECT HR.COUNT_ROWS FROM DUAL;
GRANT SELECT ON BEQUEATH_DEFINER_COUNT_ROWS_VIEW TO PUBLIC;
GRANT SELECT ON BEQUEATH_INVOKER_COUNT_ROWS_VIEW TO PUBLIC;
GRANT SELECT ON COUNTRIES TO SPIDER;
GRANT SELECT ON JOBS TO SUPERMAN;
-- AS Spider
SELECT *
FROM HR.BEQUEATH_DEFINER_COUNT_ROWS_VIEW; --44
SELECT *
FROM HR.BEQUEATH_INVOKER_COUNT_ROWS_VIEW; --25 <-- since it has access only to COUNTRIES
-- AS Superman
SELECT *
FROM HR.BEQUEATH_DEFINER_COUNT_ROWS_VIEW; --44
SELECT *
FROM HR.BEQUEATH_INVOKER_COUNT_ROWS_VIEW; --19 <-- since it has access only to JOBS
upvoted 1 times
...
...
Log in to ExamTopics
Sign in:
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
Goto10
2 years agoGoto10
2 years ago