|
| 1 | +--- |
| 2 | +title: 'Sympa::Scenario(3)' |
| 3 | +--- |
| 4 | + |
| 5 | +# NAME |
| 6 | + |
| 7 | +Sympa::Scenario - Authorization scenarios |
| 8 | + |
| 9 | +# SYNOPSIS |
| 10 | + |
| 11 | + use Sympa::Scenario; |
| 12 | + |
| 13 | + my $scenario = Sympa::Scenario->new($list, 'send', name => 'private'); |
| 14 | + my $result = $scenario->authz('md5', {sender => $sender}); |
| 15 | + |
| 16 | +# DESCRIPTION |
| 17 | + |
| 18 | +[Sympa::Scenario](./Sympa-Scenario.3.md) provides feature of scenarios which perform authorization |
| 19 | +on functions of Sympa software against users and clients. |
| 20 | + |
| 21 | +## Methods |
| 22 | + |
| 23 | +- new ( $that, $function, \[ name => $name \], |
| 24 | +\[ dont\_reload\_scenario => 1 \] ) |
| 25 | + |
| 26 | + _Constructor_. |
| 27 | + Creates a new [Sympa::Scenario](./Sympa-Scenario.3.md) instance. |
| 28 | + |
| 29 | + Parameters: |
| 30 | + |
| 31 | + - $that |
| 32 | + |
| 33 | + Context of scenario, list or domain |
| 34 | + (note that scenario does not have site context). |
| 35 | + |
| 36 | + - $function |
| 37 | + |
| 38 | + Specifies scenario function. |
| 39 | + |
| 40 | + - name => $name |
| 41 | + |
| 42 | + Specifies scenario name. |
| 43 | + If the name was not given, it is taken from list/domain configuration. |
| 44 | + See ["Scenarios"](#scenarios) for details. |
| 45 | + |
| 46 | + - dont\_reload\_scenario => 1 |
| 47 | + |
| 48 | + If set, won't check if scenario files were updated. |
| 49 | + |
| 50 | + Returns: |
| 51 | + |
| 52 | + A new [Sympa::Scenario](./Sympa-Scenario.3.md) instance. |
| 53 | + |
| 54 | +- authz ( $auth\_method, \\%context, \[ debug => 1\] ) |
| 55 | + |
| 56 | + _Instance method_. |
| 57 | + Return the action to perform for 1 sender |
| 58 | + using 1 auth method to perform 1 function. |
| 59 | + |
| 60 | + Parameters: |
| 61 | + |
| 62 | + - $auth\_method |
| 63 | + |
| 64 | + 'smtp', 'md5', 'pgp', 'smime' or 'dkim'. |
| 65 | + Note that \`pgp\` has not been implemented. |
| 66 | + |
| 67 | + - \\%context |
| 68 | + |
| 69 | + A hashref containing information to evaluate scenario (scenario context). |
| 70 | + |
| 71 | + - debug => 1 |
| 72 | + |
| 73 | + Adds keys in the returned hashref. |
| 74 | + |
| 75 | + Returns: |
| 76 | + |
| 77 | + A hashref containing following items. |
| 78 | + |
| 79 | + - {action} |
| 80 | + |
| 81 | + 'do\_it', 'reject', 'request\_auth', |
| 82 | + 'owner', 'editor', 'editorkey' or 'listmaster'. |
| 83 | + |
| 84 | + - {reason} |
| 85 | + |
| 86 | + Defined if {action} is 'reject' and in case `reject(reason='...')`: |
| 87 | + Key for template authorization\_reject.tt2. |
| 88 | + |
| 89 | + - {tt2} |
| 90 | + |
| 91 | + Defined if {action} is 'reject' and in case `reject(tt2='...')` or |
| 92 | + `reject('...tt2')`: |
| 93 | + Mail template name to be sent back to request sender. |
| 94 | + |
| 95 | + - {condition} |
| 96 | + |
| 97 | + The checked condition (defined if debug is set). |
| 98 | + |
| 99 | + - {auth\_method} |
| 100 | + |
| 101 | + The checked auth\_method (defined if debug is set). |
| 102 | + |
| 103 | +- get\_current\_title ( ) |
| 104 | + |
| 105 | + _Instance method_. |
| 106 | + Gets the title of the scenarioin the current language context. |
| 107 | + |
| 108 | +- is\_purely\_closed ( ) |
| 109 | + |
| 110 | + _Instance method_. |
| 111 | + Returns true value if the scenario obviously returns "reject" action. |
| 112 | + |
| 113 | +- to\_string ( ) |
| 114 | + |
| 115 | + _Instance method_. |
| 116 | + Returns source text of the scenario. |
| 117 | + |
| 118 | +## Functions |
| 119 | + |
| 120 | +- get\_scenarios ( $that, $function ) |
| 121 | + |
| 122 | + _Function_. |
| 123 | + Gets all scenarios beloging to context $that and function $function. |
| 124 | + |
| 125 | +- request\_action ( $that, $function, $auth\_method, \\%context, |
| 126 | +\[ name => $name \], \[ dont\_reload\_scenario => 1 \], \[ debug => 1\] ) |
| 127 | + |
| 128 | + _Function_. Obsoleted on Sympa 6.2.42. Use authz() method instead. |
| 129 | + |
| 130 | +## Attributes |
| 131 | + |
| 132 | +Instance of [Sympa::Scenario](./Sympa-Scenario.3.md) has these attributes: |
| 133 | + |
| 134 | +- {context} |
| 135 | + |
| 136 | + Context given by new(). |
| 137 | + |
| 138 | +- {function} |
| 139 | + |
| 140 | + Name of function. |
| 141 | + |
| 142 | +- {name} |
| 143 | + |
| 144 | + Scenario name. |
| 145 | + |
| 146 | +- {file\_path} |
| 147 | + |
| 148 | + Full path of scenario file. |
| 149 | + |
| 150 | +## Scenarios |
| 151 | + |
| 152 | +A scenario file is named as _`function`_`.`_`name`_, |
| 153 | +where _`function`_ is one of predefined function names, and |
| 154 | +_`name`_ distinguishes policy. |
| 155 | + |
| 156 | +If new() is called without `name` option, it is taken from configuration |
| 157 | +parameter of context. Some functions don't have corresponding configuration |
| 158 | +parameter and `name` options for them are mandatory. |
| 159 | + |
| 160 | +# SEE ALSO |
| 161 | + |
| 162 | +[sympa\_scenario(5)](./sympa_scenario.5.md). |
| 163 | + |
| 164 | +# HISTORY |
| 165 | + |
| 166 | +authz() method obsoleting request\_action() function introduced on |
| 167 | +Sympa 6.2.41b. |
0 commit comments