apex_add_auth_scheme
Create an Oracle APEX authorization scheme by writing a PL/SQL function that returns TRUE to allow access, with options for caching and error messaging.
Instructions
Create an authorization scheme (IS_ADMIN, IS_MANAGER, etc.).
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"scheme_name": "<scheme_name>",
"function_body": "<function_body>"
},
"name": "apex_add_auth_scheme"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| caching | No | When to re-evaluate: - "BY_USER_BY_SESSION": Cached per user per session (default, best performance) - "BY_USER_BY_PAGE_VIEW": Re-evaluated on every page view - "NO_CACHING": Always re-evaluated (use for dynamic permissions) | BY_USER_BY_SESSION |
| scheme_name | Yes | Unique name (e.g., "IS_ADMIN", "IS_MANAGER", "CAN_EDIT_RECORDS"). | |
| error_message | No | Message shown when access is denied. | Access denied. |
| function_body | Yes | PL/SQL function body that returns BOOLEAN. The function MUST return TRUE to grant access. Has access to: apex_application.g_user, apex_util.get_session_state(). Example: "return apex_util.get_session_state('APP_USER_ROLE') = 'ADMIN';" |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |