Unverified Commit 2d9514d6 authored by IKEDA Soji's avatar IKEDA Soji Committed by GitHub
Browse files

Merge branch 'sympa-6.2' into add+del-commands

parents bcd45ae0 ce354529
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -803,20 +803,30 @@ sub valid_robot { ...@@ -803,20 +803,30 @@ sub valid_robot {
return 1; return 1;
} }
## Returns the SSO record correponding to the provided sso_id # Returns the SSO record correponding to the provided service_id
## return undef if none was found # return undef if none was found
sub get_sso_by_id { # Old name: get_sso_by_id().
my %param = @_; sub get_auth_service {
my $robot = shift;
unless (defined $param{'service_id'} && defined $param{'robot'}) { my $auth_type = shift;
return undef; my $service_id = shift;
}
if ($auth_type eq 'cas') {
foreach my $sso (@{$Conf{'auth_services'}{$param{'robot'}}}) { return undef unless $service_id;
$log->syslog('notice', 'SSO: %s', $sso->{'service_id'}); return [
next unless ($sso->{'service_id'} eq $param{'service_id'}); grep {
$_->{auth_type} eq $auth_type
return $sso; and $_->{auth_service_name} eq $service_id
} @{$Conf{'auth_services'}{$robot}}
]->[-1];
} elsif ($auth_type eq 'generic_sso') {
return undef unless $service_id;
return [
grep {
$_->{auth_type} eq $auth_type
and $_->{service_id} eq $service_id
} @{$Conf{'auth_services'}{$robot}}
]->[-1];
} }
return undef; return undef;
...@@ -942,11 +952,6 @@ sub _load_auth { ...@@ -942,11 +952,6 @@ sub _load_auth {
return undef; return undef;
} }
$Conf{'cas_number'}{$robot} = 0;
$Conf{'generic_sso_number'}{$robot} = 0;
$Conf{'ldap_number'}{$robot} = 0;
$Conf{'use_passwd'}{$robot} = 0;
## Parsing auth.conf ## Parsing auth.conf
while (<IN>) { while (<IN>) {
...@@ -1008,7 +1013,6 @@ sub _load_auth { ...@@ -1008,7 +1013,6 @@ sub _load_auth {
'Incorrect CAS paragraph in auth.conf'); 'Incorrect CAS paragraph in auth.conf');
next; next;
} }
$Conf{'cas_number'}{$robot}++;
eval "require AuthCAS"; eval "require AuthCAS";
if ($EVAL_ERROR) { if ($EVAL_ERROR) {
...@@ -1053,26 +1057,10 @@ sub _load_auth { ...@@ -1053,26 +1057,10 @@ sub _load_auth {
next; next;
} }
$Conf{'cas_id'}{$robot}
{$current_paragraph->{'auth_service_name'}}{'casnum'}
= scalar @paragraphs;
## Default value for auth_service_friendly_name IS
## auth_service_name
$Conf{'cas_id'}{$robot}
{$current_paragraph->{'auth_service_name'}}
{'auth_service_friendly_name'} =
$current_paragraph->{'auth_service_friendly_name'}
|| $current_paragraph->{'auth_service_name'};
## Force the default scope because '' is interpreted as ## Force the default scope because '' is interpreted as
## 'base' ## 'base'
$current_paragraph->{'scope'} ||= 'sub'; $current_paragraph->{'scope'} ||= 'sub';
} elsif ($current_paragraph->{'auth_type'} eq 'generic_sso') { } elsif ($current_paragraph->{'auth_type'} eq 'generic_sso') {
$Conf{'generic_sso_number'}{$robot}++;
$Conf{'generic_sso_id'}{$robot}
{$current_paragraph->{'service_id'}} =
$#paragraphs + 1;
## Force the default scope because '' is interpreted as ## Force the default scope because '' is interpreted as
## 'base' ## 'base'
$current_paragraph->{'scope'} ||= 'sub'; $current_paragraph->{'scope'} ||= 'sub';
...@@ -1089,13 +1077,11 @@ sub _load_auth { ...@@ -1089,13 +1077,11 @@ sub _load_auth {
if (defined $current_paragraph->{$parameter}); if (defined $current_paragraph->{$parameter});
} }
} elsif ($current_paragraph->{'auth_type'} eq 'ldap') { } elsif ($current_paragraph->{'auth_type'} eq 'ldap') {
$Conf{'ldap'}{$robot}++;
$Conf{'use_passwd'}{$robot} = 1;
## Force the default scope because '' is interpreted as ## Force the default scope because '' is interpreted as
## 'base' ## 'base'
$current_paragraph->{'scope'} ||= 'sub'; $current_paragraph->{'scope'} ||= 'sub';
} elsif ($current_paragraph->{'auth_type'} eq 'user_table') { } elsif ($current_paragraph->{'auth_type'} eq 'user_table') {
$Conf{'use_passwd'}{$robot} = 1; ;
} }
# setting default # setting default
$current_paragraph->{'regexp'} = '.*' $current_paragraph->{'regexp'} = '.*'
......
...@@ -192,7 +192,6 @@ nobase_modules_DATA = \ ...@@ -192,7 +192,6 @@ nobase_modules_DATA = \
Sympa/WWW/FastCGI.pm \ Sympa/WWW/FastCGI.pm \
Sympa/WWW/Marc.pm \ Sympa/WWW/Marc.pm \
Sympa/WWW/Marc/Search.pm \ Sympa/WWW/Marc/Search.pm \
Sympa/WWW/Report.pm \
Sympa/WWW/SharedDocument.pm \ Sympa/WWW/SharedDocument.pm \
Sympa/WWW/Session.pm \ Sympa/WWW/Session.pm \
Sympa/WWW/SOAP.pm \ Sympa/WWW/SOAP.pm \
......
...@@ -1201,7 +1201,7 @@ our %pinfo = ( ...@@ -1201,7 +1201,7 @@ our %pinfo = (
group => 'sending', group => 'sending',
gettext_id => "Attachment type", gettext_id => "Attachment type",
gettext_comment => gettext_comment =>
"List owners may decide to add message headers or footers to messages sent via the list. This parameter defines the way a footer/header is added to a message.\nmime: \nThe default value. Sympa will add the footer/header as a new MIME part.\nappend: \nSympa will not create new MIME parts, but will try to append the header/footer to the body of the message. Predefined message-footers will be ignored. Headers/footers may be appended to text/plain messages only.", "List owners may decide to add message headers or footers to messages sent via the list. This parameter defines the way a footer/header is added to a message.\nmime: \nThe default value. Sympa will add the footer/header as a new MIME part.\nappend: \nSympa will not create new MIME parts, but will try to append the header/footer to the body of the message. Predefined message-footers will be ignored.",
format => ['mime', 'append'], format => ['mime', 'append'],
default => 'mime' default => 'mime'
}, },
...@@ -1489,7 +1489,7 @@ our %pinfo = ( ...@@ -1489,7 +1489,7 @@ our %pinfo = (
order => 30.00_01, order => 30.00_01,
group => 'command', group => 'command',
default => 'public_listmaster', default => 'public_listmaster',
sample => 'intranet', sample => 'listmaster',
gettext_id => 'Who is able to create lists', gettext_id => 'Who is able to create lists',
gettext_comment => gettext_comment =>
'Defines who can create lists (or request list creation) by creating new lists or by renaming or copying existing lists.', 'Defines who can create lists (or request list creation) by creating new lists or by renaming or copying existing lists.',
......
...@@ -487,6 +487,31 @@ sub error { ...@@ -487,6 +487,31 @@ sub error {
return undef; return undef;
} }
# Old name: Sympa::DatabaseManager::_check_db_field_type().
sub is_sufficient_field_type {
my $self = shift;
my $required = shift;
my $effective = shift;
my ($required_type, $required_size, $effective_type, $effective_size);
if ($required =~ /^(\w+)(\((\d+)\))?$/) {
($required_type, $required_size) = ($1, $3);
}
if ($effective =~ /^(\w+)(\((\d+)\))?$/) {
($effective_type, $effective_size) = ($1, $3);
}
if ( ($effective_type // '') eq ($required_type // '')
and (not defined $required_size or $effective_size >= $required_size))
{
return 1;
}
return 0;
}
sub set_persistent { sub set_persistent {
my $self = shift; my $self = shift;
my $flag = shift; my $flag = shift;
......
...@@ -8,8 +8,8 @@ ...@@ -8,8 +8,8 @@
# Copyright (c) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, # Copyright (c) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
# 2006, 2007, 2008, 2009, 2010, 2011 Comite Reseau des Universites # 2006, 2007, 2008, 2009, 2010, 2011 Comite Reseau des Universites
# Copyright (c) 2011, 2012, 2013, 2014, 2015, 2016, 2017 GIP RENATER # Copyright (c) 2011, 2012, 2013, 2014, 2015, 2016, 2017 GIP RENATER
# Copyright 2018 The Sympa Community. See the AUTHORS.md file at the # Copyright 2018, 2021 The Sympa Community. See the
# top-level directory of this distribution and at # AUTHORS.md file at the top-level directory of this distribution and at
# <https://github.com/sympa-community/sympa.git>. # <https://github.com/sympa-community/sympa.git>.
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
...@@ -210,6 +210,32 @@ Returns: ...@@ -210,6 +210,32 @@ Returns:
True if the field is an auto-increment field, false otherwise True if the field is an auto-increment field, false otherwise
=item is_sufficient_field_type ( $required, $actual )
I<Overridable>, I<only for SQL driver>.
Checks if database field type is sufficient.
Parameters:
=over
=item $required
Required field type.
=item $actual
Actual field type.
=back
Returns:
The true value if actual field type is appropriate AND size is equal to or
greater than required size.
This method was added on Sympa 6.2.67b.1.
=item set_autoinc ( { table => $table, field => $field } ) =item set_autoinc ( { table => $table, field => $field } )
I<Required to update database structure>. I<Required to update database structure>.
......
...@@ -8,8 +8,8 @@ ...@@ -8,8 +8,8 @@
# Copyright (c) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, # Copyright (c) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
# 2006, 2007, 2008, 2009, 2010, 2011 Comite Reseau des Universites # 2006, 2007, 2008, 2009, 2010, 2011 Comite Reseau des Universites
# Copyright (c) 2011, 2012, 2013, 2014, 2015, 2016, 2017 GIP RENATER # Copyright (c) 2011, 2012, 2013, 2014, 2015, 2016, 2017 GIP RENATER
# Copyright 2018, 2020 The Sympa Community. See the AUTHORS.md # Copyright 2018, 2020, 2021 The Sympa Community. See the
# file at the top-level directory of this distribution and at # AUTHORS.md file at the top-level directory of this distribution and at
# <https://github.com/sympa-community/sympa.git>. # <https://github.com/sympa-community/sympa.git>.
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
...@@ -335,6 +335,20 @@ sub get_primary_key { ...@@ -335,6 +335,20 @@ sub get_primary_key {
return \%found_keys; return \%found_keys;
} }
sub is_sufficient_field_type {
my $self = shift;
my $required = shift;
my $actual = shift;
# As of MySQL 8.0.17, the display width attribute is deprecated for
# integer data types (MeriaDB has not).
if ( $required =~ /\A((?:tiny|small|medium|big)?int)(?:[(]\d+[)])?\z/
and $actual eq $1) {
return 1;
}
return $self->SUPER::is_sufficient_field_type($required, $actual);
}
sub unset_primary_key { sub unset_primary_key {
my $self = shift; my $self = shift;
my $param = shift; my $param = shift;
......
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