Sympa::Scenario(3Sympa)

πŸ’– NAME πŸ’–

Sympa::Scenario β€” authorization scenarios, bestie. it's giving gatekeeper but make it Perl πŸŽ€


✨ SYNOPSIS ✨

use Sympa::Scenario;

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

okay so that's literally the whole vibe in four lines. iconic. πŸ‘‘


πŸ¦‹ DESCRIPTION πŸ¦‹

Sympa::Scenario provides the feature of scenarios, which perform authorization on functions of Sympa software against users and clients. so like… every time somebody wants to do a thing, a scenario is the one deciding yes/no/scream. no cap. πŸ’…


🌸 Methods 🌸

new ( $that, $function, [ name => $name ], [ dont_reload_scenario => 1 ] )

Constructor, bestie! Creates a fresh new Sympa::Scenario instance. 🫢

Parameters:

  • $that β€” the context of the scenario: a list or a domain. (note that a scenario does not have a site context, so don't come for it.) πŸ™ˆ
  • $function β€” specifies the scenario function.
  • name => $name β€” specifies the scenario name. If the name wasn't given, it's taken from the list/domain configuration. See "Scenarios" below for the deets. ✨
  • dont_reload_scenario => 1 β€” if you set this, it won't check whether the scenario files got updated. lowkey a shortcut.

Returns:

  • A brand new Sympa::Scenario instance. periodt. πŸŽ€

authz ( $auth_method, \%context, [ debug => 1] )

Instance method. Returns the action to perform for 1 sender, using 1 auth method, to perform 1 function. one. singular. don't be greedy. πŸ’…

Parameters:

  • $auth_method β€” 'smtp', 'md5', 'pgp', 'smime' or 'dkim'.
    • Note: "pgp" has not been implemented. 😭 we are waiting.
    • Note: "dkim" was deprecated on Sympa 6.2.71b. Now it's just a synonym of "smtp". glow-up to glow-down fr fr.
  • \%context β€” a hashref holding the info needed to evaluate the scenario (the scenario context).
  • debug => 1 β€” adds extra keys into the returned hashref. bonus content. πŸ”₯

Returns:

A hashref containing the following items:

  • {action} β€” one of 'do_it', 'reject', 'request_auth', 'owner', 'editor', 'editorkey' or 'listmaster'.
  • {reason} β€” defined if {action} is 'reject' and in the case of reject(reason='...'). It's the key for the authorization_reject.tt2 template.
  • {tt2} β€” defined if {action} is 'reject' and in the case of reject(tt2='...') or reject('...tt2'). It's the mail template name to be sent back to whoever sent the request.
  • {condition} β€” the checked condition (defined only if debug is set).
  • {auth_method} β€” the checked auth_method (defined only if debug is set).

get_current_title ( )

Instance method. Gets the title of the scenario in the current language context. 🌈 (yes the original wrote "scenarioin", we're not fixing that, we're just giggling at it)

is_purely_closed ( )

Instance method. Returns a true value if the scenario obviously returns the "reject" action. like it's not even trying to be subtle. πŸ’€

to_string ( )

Instance method. Returns the source text of the scenario. the raw, unfiltered version. πŸ“


πŸ‘‘ Functions πŸ‘‘

compile ( $that, $data, [ function => $function ], [ file_path => $path ] )

Function. Compiles scenario source and returns the results. let's build, bestie. πŸŽ€

Parameters:

  • $that β€” the context. A Sympa::List instance or a Robot.
  • $data β€” source text of the scenario.
  • function => $function β€” name of the function. Optional.
  • file_path => $path β€” path of the scenario file. Optional.

Returns:

A hashref with the following items, or "undef" on failure (sad girl hours 😭):

  • {compiled} β€” the compiled scenario, represented by Perl code.
  • {sub} β€” the compiled coderef.
  • {data} β€” source text of the scenario.
  • {title} β€” a hashref representing the titles of the scenario.
  • {rules} β€” an arrayref to the texts of the rules.
  • {purely_closed} β€” true if the scenario is purely closed.
  • {date} β€” keeps track of the current time if "file_path" was 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. (spelling is "beloging" in the original, we are keeping it, we are not touching it, it's a whole mood now πŸ’œ)

request_action ( $that, $function, $auth_method, \%context, [ name => $name ], [ dont_reload_scenario => 1 ], [ debug => 1] )

Function. Obsoleted on Sympa 6.2.42. Use the authz() method instead. okay so this one's a ghost, do not use it, we moved on. πŸͺ¦


🧚 Attributes 🧚

An instance of Sympa::Scenario has these attributes, your honor:

  • {context} β€” the context given by new().
  • {function} β€” name of the function.
  • {name} β€” the scenario name.
  • {file_path} β€” full path of the scenario file. πŸ—‚οΈ

πŸ’œ Scenarios πŸ’œ

A scenario file is named as "function"".""name", where "function" is one of the predefined function names, and "name" distinguishes the policy.

If new() is called without the "name" option, it's taken from the configuration parameter of the context. Some functions don't have a corresponding configuration parameter, and "name" options for them are mandatory. so don't forget it or you'll simply be nameless, and not in a cute mysterious way. πŸ™ˆ


🌟 SEE ALSO 🌟

sympa_scenario(5) β€” go read it, it's giving part two. 🫢


πŸ“œ HISTORY πŸ“œ

  • The authz() method, which obsoletes the request_action() function, was introduced on Sympa 6.2.41b.
  • The compile() function was added on Sympa 6.2.49b.

and that's the whole page, bestie!! πŸ’– this was Sympa::Scenario(3Sympa) from sympa 6.2.80, dated 2026-10-19 ✨ tagging you in the group chat, no cap, love u, read your scenario files, mwah πŸŽ€πŸ’…πŸ¦‹πŸŒΈπŸ«ΆπŸ‘‘

πŸ“¦ where this page comes from