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;

8 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

sathish said...

Thanks for the informative article. This is one of the best resources I have found in quite some time. Nicely written and great info. I really cannot thank you enough for sharing.
Selenium training in Chennai
Selenium training in Bangalore
Selenium training in Pune
Selenium Online training

Praylin S said...

Great post with valid information. This is really helpful. Do share more such posts.
Tally Course in Chennai
Tally Classes in Chennai
JavaScript Training in Chennai
JavaScript Course in Chennai
C C++ Training in Chennai
C Training in Chennai
Tally Course in Anna Nagar
Tally Course in T Nagar

karthik said...

All are saying the same thing repeatedly, but in your blog I had a chance to get some useful and unique information, I love your writing style very much, I would like to suggest your blog in my dude circle, so keep on updates.
microsoft azure training in bangalore
rpa training in bangalore
best rpa training in bangalore
rpa online training