![]() |
![]()
| ![]() |
![]()
RESPONSE RELATED ATTRIBUTES AND METHODSMost of the following methods are accessors to attributes. Except from those starting with "set_*" they can also be called without arguments to retrieve the current value. Please note that currently some of these attributes are of type Scalar, ArrayRef or HashRef while others are "data transfer objects" (DTOs) that use OpenXPKI::Client::UI::Response::DTO and encapsulate several values. The DTOs have a "resolve" method which recursively builds a HashRef from the encapsulated data. The HashRef gets converted to JSON (in "_render_body_to_str") and is sent to the web UI. redirectEnforce a client side redirect to the given page: $self->redirect->to('workflow!search'); $self->redirect->external('https://...'); confined_responseEnforce response to a confined request, i.e. and autocomplete query. Returns an arbitrary JSON structure to the web UI. $self->confined_response([1,2,3]); mainSet the structure of the main contents. $self->main->add_section(...); $self->main->add_form(...); "add_form" receives constructor parameters for OpenXPKI::Client::UI::Response::Section::Form. infoboxSet the structure of the right hand side info box. Usage equivalent to "main". languageSet the language. $self->language('de'); menuSet the menu structure. $self->menu->items([ ... ]); # or $self->menu->add_item({ key => 'logout', label => 'I18N_OPENXPKI_UI_CLEAR_LOGIN', }); on_exceptionAdd an exception handler for HTTP codes. $self->on_exception->add_handler( status_code => [ 403, 401 ], redirect => $target, ); page and set_pageSet page related information. $self->page->label('I18N_OPENXPKI_UI_WORKFLOW_BULK_TITLE'); $self->page->shortlabel('I18N_OPENXPKI_UI_WORKFLOW_BULK_TITLE'); $self->page->description('I18N_OPENXPKI_UI_WORKFLOW_BULK_DESCRIPTION'); $self->page->breadcrumb([...]); $self->page->css_class('important'); $self->page->large(1); # set several attributes at once $self->set_page( label => 'I18N_OPENXPKI_UI_WORKFLOW_BULK_TITLE', description => 'I18N_OPENXPKI_UI_WORKFLOW_BULK_DESCRIPTION', ); pingConfigure keepalive ping to an endpoint. $self->ping({ href => '...', timeout => 30 }); # timeout is in milliseconds refresh and set_refreshConfigure a periodic page refresh timer. $self->refresh->uri("workflow!load!wf_id!$wf_id"); $self->refresh->timeout(30); # set several attributes at once $self->set_refresh( uri => "workflow!load!wf_id!$wf_id", timeout => 30, ); rtokenSet the request token. $self->rtoken($rtoken); statusSet status or error message. $self->status->info('I18N_OPENXPKI_UI_WORKFLOW_STATE_WATCHDOG_PAUSED_30SEC'); $self->status->success('...'); $self->status->warn('...'); $self->status->error('...'); tenantSet the tenant. $self->tenant($tenant); user and set_userSet user related information. $self->user->name(...); $self->user->role(...); $self->user->realname(...); $self->user->role_label(...); $self->user->pki_realm(...); $self->user->pki_realm_label(...); $self->user->checksum(...); $self->user->sid(...); $self->user->last_login($timestamp); $self->user->tenants([...]); # set several attributes at once $self->set_user(%{ $user }); add_headerAdd one or more HTTP response headers. $response->add_header(-type => 'application/json; charset=UTF-8'); get_header_strReturn the string containing the HTTP headers. print $self->get_header_str($cgi); raw_bytes and raw_bytes_callbackSet a raw byte output (i.e. no JSON response) to send files to the client. $self->add_header(-type => $data->{mime}, -attachment => $data->{attachment}); $self->raw_bytes($data); # to avoid storing large data in memory $self->raw_bytes_callback(sub { my $consume = shift; open (my $fh, "<", $source) || die "Unable to open $source: $!"; while (my $line = <$fh>) { $consume->($line) } close $fh; }); METHODSinternal_redirectInternal redirection from an "action_*" method to a page ("init_*" method). From within an "action_*" method you may do this: return $self->internal_redirect('home!welcome' => { name => "OpenXPKI" }); send_command_v2Sends the given command to the backend and returns the result. If an error occurs while executing the command (e.g. validation error from a workflow action), the global status is set in the response sent to the client, so the UI can show the error. This can be suppressed by setting the third parameter to 1. Parameters
paramReturns a single input parameter, i.e. real CGI parameters and those appended to the action name using "!". Parameters from the action name have precedence. If the input parameter has got multiple values then only the first value is returned. Parameters
logReturn the class logger (log4perl ref). loggerDeprecated alias for "log". _render_body_to_strAssemble the return hash from the internal caches and return the result as a string. renderAssemble the return hash from the internal caches and send the result to the browser. _escape ( string )Replace html entities in string by their encoding __register_wf_token( wf_info, token )Generates a new random id and stores the passed workflow info, expects a wf_info and the token info to store as parameter, returns a hashref with the definiton of a hidden field which can be directly pushed onto the field list. wf_info can be undef / empty string. __register_wf_token_initial ( wf_type, token )Create a token to init a new workflow, expects the name of the workflow as string and an optional hash to pass as initial parameters to the create method. Returns the full action target as string. __fetch_wf_token( wf_token, purge )Return the hashref stored by __register_wf_token for the given token id. If purge is set to a true value, the info is purged from the session context. __purge_wf_token( wf_token )Purge the token info from the session. __persist_responsePersist the given response data to retrieve it after an HTTP roundtrip. Used to break out of the JavaScript app for downloads or to reroute result pages. Returns the page call URI for "init_fetch" in OpenXPKI::Client::UI::Cache. __fetch_responseGet the data for the persisted response. __generate_uidGenerate a random uid (RFC 3548 URL and filename safe base64) __render_pagerReturn a pager definition hash with default settings, requires the query result hash as argument. Defaults can be overriden passing a hash as second argument. __build_attribute_subqueryExpects an attribtue query definition hash (from uicontrol), returns arrayref to be used as attribute subquery in certificate and workflow search. __build_attribute_presetExpects an attribtue query definition hash (from uicontrol), returns arrayref to be used as preset when reloading the search form transate_sql_wildcardsReplace "literal" wildcards asterisk and question mark by percent and underscore for SQL queries. decrypted_paramReturn a decrypted JWT input parameter (whose only allowed type is HashRef). "undef" is returned if the parameter does not exist or if it was not encrypted. Parameters
make_autocomplete_queryCreate the autocomplete config for a UI text field from the given workflow field configuration $wf_field. Also returns an additional hidden, to-be-encrypted UI field definition. Text input fields with autocompletion are configured as follows: type: text autocomplete: action: certificate!autocomplete params: user: param_1: field_name_1 param_2: field_name_1 persist: query: status: { "-like": "%done" } Parameters below "user" are filled from the referenced form fields. Parameters below "persist" may contain data structures (HashRefs, ArrayRefs) as they are backend-encrypted and sent to the client as a JWT token. They can be considered safe from user manipulation. Parameters
fetch_autocomplete_paramsUses the "__encrypted" request parameter to re-assemble the full hash of autocomplete parameters by decoding the encrypted static values and querying the whitelisted dynamic values. Parameters
Returns a HashRef of query parameters
|