DOKK / manpages / debian 10 / sympa / Sympa::WWW::Session.3sympa.en
Sympa::WWW::Session(3Sympa) sympa 6.2.40 Sympa::WWW::Session(3Sympa)

Sympa::WWW::Session - Web session

  use Sympa::WWW::Session;
  
  my $session = Sympa::WWW::Session->new($robot,
      {cookie => Sympa::WWW::Session::get_session_cookie($ENV{'HTTP_COOKIE'})}
  );
  $session->renew();
  $session->store();

  $session->confirm_action($action, 'init');
  
  sub do_myaction {
  
      # Validate arguments...
  
      $param->{arg} = $arg;
      my $next_action = $session->confirm_action($action, $response,
          $arg, $previous_action);
      return $next_action unless $next_action eq '1';
  
      # Process action...
  
  }

Sympa::WWW::Session provides web session for Sympa web interface. HTTP cookie is required to determine users. Session store is used to keep users' personal data.

Constructor. Creates new instance and loads user data from session store.

Parameters:

$robot
Context of the session.
{ cookie => $cookie }
HTTP cookie.

Returns:

A new instance.

Instance method. Casts the instance to hashref.

Parameters:

None.

Returns:

A hashref including attributes of instance (see "Attributes").

Instance method. Check if action has been confirmed.

Confirmation follows two steps:

1.
The method is called with no (undefined) response. The action, hash of argument and previous_action are stored into session store. And then this method returns 'confirm_action'.
2.
The method is called with 'confirm' or other true value as response. If action and hash of argument match with those in session store, and:
  • If 'confirm' is given, returns 1.
  • If other true value is given, returns previous action stored in session store (previous_action given in argument is ignored).

In both cases session store is cleared.

Anytime when the action submitted by user is determined, This method may be called with response as 'init'. In this case, if action doesn't match with that in session store, session store will be cleared.

Parameters:

$action
Action to be checked.
$response
Response from user: 'init', false value (not yet checked), 'confirm' and others (cancelled). This may typically be given by user using "response_action" parameter.
Argument(s) of action.
The action users will be redirected when action is confirmed. This may typically given by user using "previous_action" parameter.
Instance method. TBD.
Instance method. Renews the session. Updates internal session ID and HTTP cookie.
Instance method. Stores session into session store.

Function. Deprecated.
Function. TBD.
Function. TBD.
Function. TBD.
Function. Deprecated.
Instance method. TBD.
Instance method. TBD.

TBD.

Sympa::DatabaseManager.

SympaSession appeared on Sympa 5.4a3.

It was renamed to Sympa::Session on Sympa 6.2a.41, then Sympa::WWW::Session on Sympa 6.2.26.

"confirm_action" method was added on Sympa 6.2.17.

2020-12-10 6.2.40