Saturday 30 May 2009

Checking an Authorization Scheme within a PL/SQL Block

Recently, I had a quite tricky requirement where within a customer application I needed to check if user has a required role to run a process, edit a field or see an information. Many times these conditions were a combination of different authorization schemes and other rules determined during the runtime of the application. So the problem was not solved by just adding an authorization scheme to the object. More than one authorization scheme needed to be checked together with some other conditions. Using the apex_util package and the function public_check_authorization I was able to successfully acomplish those tasks. This is a modified example of the code I used there:


BEGIN
IF ( apex_util.public_check_authorization ('AUTH_GROUP_1')
OR apex_util.public_check_authorization ('AUTH_GROUP_2')
)
AND :p12_status = '0'
THEN
RETURN TRUE;
ELSIF ( apex_util.public_check_authorization ('AUTH_GROUP_2')
OR apex_util.public_check_authorization ('AUTH_GROUP_3')
)
AND :p12_status = '1'
THEN
RETURN TRUE;
ELSE
RETURN FALSE;
END IF;
END;

7 comments:

Anonymous said...

Denis,

Thanks very much for posting this. I had wanted to do this sort of thing a while back and had no clue how to mix and match existing authorization schemes.

Carsten said...

Hello Denes,

thanks for this great post. It is very helpfully!

Carsten

Authorization Forms said...

When it comes to SQL i have lot of doubts..but when people like you provided such good articles..i have no more doubts..thanks a lot for sharing.need few more posts on querying SQL and reporting.

Authorization Forms

Denes Kubicek said...

Thanks.

Denes Kubicek

Anonymous said...

Thank you so much for the information. It saved a lot of time for me. Thanks once again

Mega said...

The above content is very interesting to read.
basic networking interview questions and answers
ccna interview questions and answers pdf

Jon Hendo said...

B2B events and from corporate user conferences to association trade shows rely on reach to maximize their stakeholders’ longtail ROI in the form of future conversions In virtual events. virtual edge and A Must-Know Guide To Corporate Event Planning