DOKK / manpages / debian 12 / sympa / Sympa::Scenario.3sympa.en
Sympa::Scenario(3Sympa) sympa 6.2.70 Sympa::Scenario(3Sympa)

Sympa::Scenario - Authorization scenarios

  use Sympa::Scenario;
  
  my $scenario = Sympa::Scenario->new($list, 'send', name => 'private');
  my $result = $scenario->authz('md5', {sender => $sender});

Sympa::Scenario provides feature of scenarios which perform authorization on functions of Sympa software against users and clients.

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.
Specifies scenario name. If the name was not given, it is taken from list/domain configuration. See "Scenarios" for details.
If set, won't check if scenario files were updated.

Returns:

A new Sympa::Scenario instance.

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).
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).
Instance method. Gets the title of the scenarioin the current language context.
Instance method. Returns true value if the scenario obviously returns "reject" action.
Instance method. Returns source text of the scenario.

Function. Compiles scenario source and returns results.

Parameters:

$that
Context. Sympa::List instance or Robot.
$data
Source text of scenario.
Name of function. Optional.
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.
Function. Gets all scenarios beloging to context $that and function $function.
Function. Obsoleted on Sympa 6.2.42. Use authz() method instead.

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.

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.

sympa_scenario(5).

authz() method obsoleting request_action() function was introduced on Sympa 6.2.41b. compile() function was added on Sympa 6.2.49b.

2023-01-26 6.2.70