Commit a569fc2d authored by IKEDA Soji's avatar IKEDA Soji
Browse files

Switch to new code.

parent 88ef15d6
This diff is collapsed.
......@@ -420,8 +420,8 @@ sub check_spam_status {
: $self->{context};
my $spam_status =
Sympa::Scenario::request_action($robot_id || $Conf::Conf{'domain'},
'spam_status', 'smtp', {'message' => $self});
Sympa::Scenario->new($robot_id, 'spam_status')
->authz('smtp', {'message' => $self});
if (defined $spam_status) {
if (ref($spam_status) eq 'HASH') {
$self->{'spam_status'} = $spam_status->{'action'};
......
......@@ -76,8 +76,8 @@ sub _twist {
do {
my $email = lc($user->{'email'});
my $result =
Sympa::Scenario::request_action($list, 'visibility',
$auth_method, $self->{scenario_context});
Sympa::Scenario->new($list, 'visibility')
->authz($auth_method, $self->{scenario_context});
my $action;
$action = $result->{'action'} if ref $result eq 'HASH';
......
......@@ -58,8 +58,8 @@ sub _twist {
Sympa::List::get_which($sender, $request->{context}, 'member')) {
# Skip hidden lists.
my $result =
Sympa::Scenario::request_action($list, 'visibility', $auth_method,
$self->{scenario_context});
Sympa::Scenario->new($list, 'visibility')
->authz($auth_method, $self->{scenario_context});
my $action = $result->{'action'} if ref $result eq 'HASH';
unless ($action) {
......
......@@ -58,8 +58,8 @@ sub _twist {
Sympa::List::get_which($email, $request->{context}, 'member')) {
# Skip hidden lists.
my $result =
Sympa::Scenario::request_action($list, 'visibility', $auth_method,
$self->{scenario_context});
Sympa::Scenario->new($list, 'visibility')
->authz($auth_method, $self->{scenario_context});
my $action = $result->{'action'} if ref $result eq 'HASH';
unless ($action) {
......
......@@ -78,8 +78,8 @@ sub _twist {
# Is the guest user allowed to subscribe in this list?
# Emulating subscription privilege of target user.
my $result =
Sympa::Scenario::request_action($list, 'subscribe', 'md5',
{sender => $email});
Sympa::Scenario->new($list, 'subscribe')
->authz('md5', {sender => $email});
my $action;
$action = $result->{'action'} if ref $result eq 'HASH';
......
......@@ -61,8 +61,8 @@ sub _twist {
foreach my $list (@{Sympa::List::get_lists($robot) || []}) {
my $result =
Sympa::Scenario::request_action($list, 'visibility', $auth_method,
$self->{scenario_context});
Sympa::Scenario->new($list, 'visibility')
->authz($auth_method, $self->{scenario_context});
my $action;
$action = $result->{'action'} if ref $result eq 'HASH';
......
......@@ -61,8 +61,8 @@ sub _twist {
$listname = $list->{'name'};
my $result =
Sympa::Scenario::request_action($list, 'visibility', $auth_method,
$self->{scenario_context});
Sympa::Scenario->new($list, 'visibility')
->authz($auth_method, $self->{scenario_context});
my $action;
$action = $result->{'action'} if ref $result eq 'HASH';
......
......@@ -98,8 +98,8 @@ sub _twist {
: $message->{'dkim_pass'} ? 'dkim'
: 'smtp';
$result = Sympa::Scenario::request_action($list, 'send', $auth_method,
$context);
$result =
Sympa::Scenario->new($list, 'send')->authz($auth_method, $context);
$action = $result->{'action'} if (ref($result) eq 'HASH');
unless (defined $action) {
......
......@@ -84,8 +84,8 @@ sub _twist {
: $request->{dkim_pass} ? 'dkim'
: 'smtp';
$result = Sympa::Scenario::request_action($that, $scenario, $auth_method,
$context);
$result =
Sympa::Scenario->new($that, $scenario)->authz($auth_method, $context);
$action = $result->{'action'} if ref $result eq 'HASH';
unless (defined $action and $action =~ /\A(?:$action_regexp)\b/) {
......
......@@ -410,8 +410,8 @@ sub _twist {
# opt-out-list are abandoned.
if ($feedback_type =~ /\babuse\b/) {
my $result =
Sympa::Scenario::request_action($list, 'unsubscribe',
'smtp', {'sender' => $original_rcpt});
Sympa::Scenario->new($list, 'unsubscribe')
->authz('smtp', {'sender' => $original_rcpt});
my $action = $result->{'action'}
if ref $result eq 'HASH';
if ($action and $action =~ /do_it/i) {
......@@ -491,8 +491,8 @@ sub _twist {
$log->syslog('debug',
"VERP for a service message, try to remove the subscriber");
my $result = Sympa::Scenario::request_action(
$list, 'del', 'smtp',
my $result = Sympa::Scenario->new($list, 'del')->authz(
'smtp',
{ 'sender' => $Conf::Conf{'listmaster'}, #FIXME
'email' => $who
}
......
......@@ -329,8 +329,8 @@ sub do_delete_subs {
foreach my $email (keys %{$Rvars->{$var}}) {
$log->syslog('notice', '%s', $email);
my $result = Sympa::Scenario::request_action(
$list, 'del', 'smime',
my $result = Sympa::Scenario->new($list, 'del')->authz(
'smime',
{ 'sender' => $Conf::Conf{'listmaster'}, #FIXME
'email' => $email,
}
......
......@@ -104,9 +104,7 @@ sub lists {
my $listname = $list->{'name'};
my $result_item = {};
my $result = Sympa::Scenario::request_action(
$list,
'visibility',
my $result = Sympa::Scenario->new($list, 'visibility')->authz(
'md5',
{ 'sender' => $sender,
'remote_application_name' => $ENV{'remote_application_name'}
......@@ -501,8 +499,8 @@ sub info {
->faultdetail("List $listname unknown");
}
my $result = Sympa::Scenario::request_action(
$list, 'info', 'md5',
my $result = Sympa::Scenario->new($list, 'info')->authz(
'md5',
{ 'sender' => $sender,
'remote_application_name' => $ENV{'remote_application_name'}
}
......@@ -956,8 +954,8 @@ sub review {
# Part of the authorization code
$user = Sympa::User::get_global_user($sender);
my $result = Sympa::Scenario::request_action(
$list, 'review', 'md5',
my $result = Sympa::Scenario->new($list, 'review')->authz(
'md5',
{ 'sender' => $sender,
'remote_application_name' => $ENV{'remote_application_name'}
}
......@@ -1284,9 +1282,7 @@ sub which {
my $result_item;
my $result = Sympa::Scenario::request_action(
$list,
'visibility',
my $result = Sympa::Scenario->new($list, 'visibility')->authz(
'md5',
{ 'sender' => $sender,
'remote_application_name' => $ENV{'remote_application_name'}
......
......@@ -634,8 +634,8 @@ sub get_privileges {
# if not privileged owner
if ($mode_read) {
my $result = Sympa::Scenario::request_action($list, 'd_read',
$auth_method, $scenario_context);
my $result = Sympa::Scenario->new($list, 'd_read')
->authz($auth_method, $scenario_context);
my $action;
if (ref($result) eq 'HASH') {
$action = $result->{'action'};
......@@ -646,8 +646,8 @@ sub get_privileges {
}
if ($mode_edit) {
my $result = Sympa::Scenario::request_action($list, 'd_edit',
$auth_method, $scenario_context);
my $result = Sympa::Scenario->new($list, 'd_edit')
->authz($auth_method, $scenario_context);
my $action;
if (ref($result) eq 'HASH') {
$action = $result->{'action'};
......@@ -678,9 +678,9 @@ sub get_privileges {
if ($current->{scenario}) {
if ($mode_read) {
my $result =
Sympa::Scenario::request_action($list, 'd_read',
$auth_method, $scenario_context,
name => $current->{scenario}{read});
Sympa::Scenario->new($list, 'd_read',
name => $current->{scenario}{read})
->authz($auth_method, $scenario_context);
my $action;
if (ref($result) eq 'HASH') {
$action = $result->{'action'};
......@@ -693,9 +693,9 @@ sub get_privileges {
if ($mode_edit) {
my $result =
Sympa::Scenario::request_action($list, 'd_edit',
$auth_method, $scenario_context,
name => $current->{scenario}{edit});
Sympa::Scenario->new($list, 'd_edit',
name => $current->{scenario}{edit})
->authz($auth_method, $scenario_context);
my $action_edit;
if (ref($result) eq 'HASH') {
$action_edit = $result->{'action'};
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment