Databases Reference
In-Depth Information
Figure 1-29. Defining a Validation function
Here we define a function that is called which returns true if the procedure is allowed or false if it
should be disallowed. Note that the signature of the function should follow the format
CREATE OR REPLACE
FUNCTION is procedure allowed(
Procedure Name IN VARCHAR2)
RETURN BOOLEAN
AS
BEGIN
IF (UPPER(Procedure Name) LIKE ('%ADMIN%')) THEN
RETURN false;
ELSE
RETURN true;
END IF;
END is procedure allowed;
In this example, if the procedure name contains the text “ADMIN” then we disallow the call;
otherwise, it is permitted. Obviously this is a very simple example; you could adapt it to take the time of
day into account, or the referring page, etc.
There is a slight overhead in calling a validation function every time, so the APEX Listener allows
you to define a cache to store the result of previous invocations of the validation function. You can
define in the security settings section how many cache entries you wish to store and you can also purge
the results (if, for example, you modified the function, you might wish to make sure the new results were
picked up), as shown in Figure 1-30.
Search WWH ::




Custom Search