Provided by: sympa_6.2.70~dfsg-2_amd64
NAME
Sympa::Scenario - Authorization scenarios
SYNOPSIS
use Sympa::Scenario; my $scenario = Sympa::Scenario->new($list, 'send', name => 'private'); my $result = $scenario->authz('md5', {sender => $sender});
DESCRIPTION
Sympa::Scenario provides feature of scenarios which perform authorization on functions of Sympa software against users and clients. Methods new ( $that, $function, [ name => $name ], [ dont_reload_scenario => 1 ] ) Constructor. Creates a new Sympa::Scenario instance. Parameters: $that Context of scenario, list or domain (note that scenario does not have site context). $function Specifies scenario function. name => $name Specifies scenario name. If the name was not given, it is taken from list/domain configuration. See "Scenarios" for details. dont_reload_scenario => 1 If set, won't check if scenario files were updated. Returns: A new Sympa::Scenario instance. authz ( $auth_method, \%context, [ debug => 1] ) Instance method. Return the action to perform for 1 sender using 1 auth method to perform 1 function. Parameters: $auth_method 'smtp', 'md5', 'pgp', 'smime' or 'dkim'. Note that `pgp` has not been implemented. \%context A hashref containing information to evaluate scenario (scenario context). debug => 1 Adds keys in the returned hashref. Returns: A hashref containing following items. {action} 'do_it', 'reject', 'request_auth', 'owner', 'editor', 'editorkey' or 'listmaster'. {reason} Defined if {action} is 'reject' and in case "reject(reason='...')": Key for template authorization_reject.tt2. {tt2} Defined if {action} is 'reject' and in case "reject(tt2='...')" or "reject('...tt2')": Mail template name to be sent back to request sender. {condition} The checked condition (defined if debug is set). {auth_method} The checked auth_method (defined if debug is set). get_current_title ( ) Instance method. Gets the title of the scenarioin the current language context. is_purely_closed ( ) Instance method. Returns true value if the scenario obviously returns "reject" action. to_string ( ) Instance method. Returns source text of the scenario. Functions compile ( $that, $data, [ function => $function ], [ file_path => $path ] ) Function. Compiles scenario source and returns results. Parameters: $that Context. Sympa::List instance or Robot. $data Source text of scenario. function => $function Name of function. Optional. file_path => $path Path of scenario file. Optional. Returns: Hashref with following items, or "undef" on failure. {compiled} Compiled scenario represented by Perl code. {sub} Compiled coderef. {data} Source text of the scenario. {title} Hashref representing titles of the scenario. {rules} Arrayref to texts of rules. {purely_closed} True if the scenario is purely closed. {date} Keep track of the current time if "file_path" is given. This is used later to reload scenario files when they changed on disk. get_scenarios ( $that, $function ) Function. Gets all scenarios beloging to context $that and function $function. request_action ( $that, $function, $auth_method, \%context, [ name => $name ], [ dont_reload_scenario => 1 ], [ debug => 1] ) Function. Obsoleted on Sympa 6.2.42. Use authz() method instead. Attributes Instance of Sympa::Scenario has these attributes: {context} Context given by new(). {function} Name of function. {name} Scenario name. {file_path} Full path of scenario file. Scenarios A scenario file is named as "function"".""name", where "function" is one of predefined function names, and "name" distinguishes policy. If new() is called without "name" option, it is taken from configuration parameter of context. Some functions don't have corresponding configuration parameter and "name" options for them are mandatory.
SEE ALSO
sympa_scenario(5).
HISTORY
authz() method obsoleting request_action() function was introduced on Sympa 6.2.41b. compile() function was added on Sympa 6.2.49b.