- Methods: All Methods Documented Methods Hide Methods
- Source: Display Source Hide Source
- Variables: Show Variables Hide Variables
Class ::xo::ConnectionContext
::xo::ConnectionContextcreate ... \
[ -mobile mobile ] \
[ -requester requester ] \
[ -url url ] \
[ -user user ] \
[ -user_id user_id ]
Defined in
Class Relations
Methods (to be applied on the object)
require (scripted, private)
xo::ConnectionContextrequire [ -url url ] [ -package_id package_id ] \ [ -parameter parameter ] [ -user_id user_id ] \ [ -actual_query actual_query ] [ -keep_cc keep_cc ]
Create or reconfigure the current connection context, ::xo::cc.
- Switches:
- -url (optional)
- Request URL. Supply a valid URL outside a connection thread.
- -package_id (optional, defaults to
"0")- Package ID, or 0 to infer it from the URL.
- -parameter (optional)
- Query parameter declarations.
- -user_id (optional, defaults to
"-1")- User ID, or -1 to derive it from the request.
- -actual_query (optional, defaults to
" ")- Query string, or a single space to read it from the connection.
- -keep_cc (optional, defaults to
"false")- Keep the existing context when one is already present.
- Testcases:
- test_xo_cc
require_package_id_from_url (scripted)
Methods (to be applied on instances)
cache (scripted)
cache_exists (scripted)
cache_get (scripted)
cache_set (scripted)
cache_unset (scripted)
eval_as_user (scripted, public)
<instance of xo::ConnectionContext> eval_as_user \ [ -user_id user_id ] cmd
Run a command as the specified different user. Essentially, this method updates xo::cc and the ad_conn array array with the specified user, runs the command and resets the user to the previous value.
- Switches:
- -user_id (optional, integer)
- switch temporarily to this user
- Parameters:
- cmd (required)
- command to be exevuted
- Testcases:
- create_test_items
exists_form_parameter (scripted)
exists_parameter (scripted)
form_parameter (scripted, public)
<instance of xo::ConnectionContext> form_parameter spec \ [ default ]
Read a form parameter, loading the request form on demand.
- Parameters:
- spec (required)
- Parameter name, optionally followed by :constraint.
- default (optional)
- Value to return when the parameter is absent.
- Returns:
- The value, or a list for a parameter marked as multiple.
- Testcases:
- create_workflow_with_instance, xowiki_test_cases
get_all_form_parameter (scripted, public)
<instance of xo::ConnectionContext> get_all_form_parameter
Load the request form if necessary and return all form parameter name and value pairs.
- Testcases:
- xowiki_test_cases, create_form_with_form_instance
get_parameter (scripted, public)
<instance of xo::ConnectionContext> get_parameter name \ [ default ]
Read a per-connection parameter override.
- Parameters:
- name (required)
- Parameter name.
- default (optional)
- Value to return when no override is set.
- Testcases:
- xowiki_test_cases, link_tests
get_user_id (scripted)
init (scripted)
lang (scripted)
load_form_parameter (scripted)
load_form_parameter_from_values (scripted)
mobile (setter, public)
<instance of xo::ConnectionContext> mobile
Get or set the mobile-client flag for this request. The initial value is based on the request user agent.
- Testcases:
- create_workflow_with_instance
perconnection_parameter_get_all (scripted)
perconnection_parameter_set_all (scripted)
permission (scripted, public)
<instance of xo::ConnectionContext> permission \ -object_id object_id -privilege privilege [ -party_id party_id ]
Call ::permission::permission_p but avoid multiple calls in the same request through caching in the connection context
- Switches:
- -object_id (required, integer)
- -privilege (required)
- -party_id (optional, integer)
- Testcases:
- xowiki_test_cases
query_parameter (scripted, public)
<instance of xo::ConnectionContext> query_parameter __spec \ [ default ]
Get query parameter with default and optional value constraints. In case the value check for the query parameter fails, and no further precautions are performed (::aa_test_noabort is set), the method raises an exception with "ad_return_complaint" and aborts the script.
- Parameters:
- __spec (required)
- has the formname or name:value_constraint
- default (optional)
- default value
- Returns:
- actual value of the query parameter
- Testcases:
- api__context, test_xo_cc, path_resolve
requester (setter)
requestor (scripted)
require_form_parameter (scripted)
returnredirect (scripted, public)
<instance of xo::ConnectionContext> returnredirect \ [ -allow_complete_url ] url
Schedule a redirect to be sent when the package replies.
- Switches:
- -allow_complete_url (optional)
- Allow a complete URL as the redirect target.
- Parameters:
- url (required)
- Redirect target.
- Returns:
- The empty string.
- Testcases:
- xowiki_test_cases
role=admin (scripted)
role=all (scripted)
role=app_group_member (scripted)
role=community_member (scripted)
role=creator (scripted)
role=registered_user (scripted)
role=swa (scripted)
role=unregistered_user (scripted)
set_parameter (scripted, public)
<instance of xo::ConnectionContext> set_parameter name value
Set a per-connection parameter override and invalidate its cached lookup.
- Parameters:
- name (required)
- Parameter name.
- value (required)
- Value to store.
- Testcases:
- create_workflow_with_instance
set_user_id (scripted)
unset_parameter (scripted)
url (setter, public)
<instance of xo::ConnectionContext> url
Get or set the request URL stored in the connection context.
- Testcases:
- create_workflow_with_instance, xowiki_test_cases
user (setter)
user_id (setter, public)
<instance of xo::ConnectionContext> user_id
Get or set the user ID stored on the connection context.
- See Also:
- {xo::ConnectionContext instproc set_user_id}
- Testcases:
- xotcl_core_tutorial_2, create_workflow_with_instance, package_normalize_path, xowiki_test_cases, link_tests, slot_interactions, path_resolve, create_form_with_form_instance
- Methods: All Methods Documented Methods Hide Methods
- Source: Display Source Hide Source
- Variables: Show Variables Hide Variables
![[i]](/resources/acs-subsite/ZoomIn16.gif)