1
votes

I'm trying to find a solution to create something similar to a server-side condition for pages. I want pages to be available depending on some global variables. I have created a function that returns a logical value in the database. How to implement it? I tried to use authorization schemes, but it doesn't work with parameters.

1
What are the "global variables" - application items? If so then your authorization scheme can look up their values.Tony Andrews
Depending on how you're trying to apply this, you may need to consider the authorisation scheme's "evalutation point". ie - once per session vs per page view.Scott

1 Answers

1
votes

As far as I understood, value returned by that function decides whether someone is allowed to use certain page or not. You didn't explain what it exactly does, so I'll presume that it returns Boolean: TRUE (yes, allow page access) or FALSE (don't allow it), based on certain parameters such as :APP_USER.

If that's so, my suggestion would be to do what you already tried but failed for some reason.

  • navigate to Shared Components
  • go to Security - Authorization Schemes
  • create a new scheme, let's call it AS_ALLOW
  • set

    • scheme type = PL/SQL function returning Boolean
    • PL/SQL function body

      return your_function(:APP_USER);
      
    • message displayed when scheme violated: "You aren't authorized to visit this page"

Now, back to page. Open its Security properties and put

  • AS_ALLOW into the "Authorization scheme"

That should do it; once the user runs the application, the function will return either TRUE or FALSE which will - in turn - allow (or not) that user's access to page that has the authorization scheme set.