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 {
return 1;
}
## Returns the SSO record correponding to the provided sso_id
## return undef if none was found
sub get_sso_by_id {
my %param = @_;
unless (defined $param{'service_id'} && defined $param{'robot'}) {
return undef;
}
foreach my $sso (@{$Conf{'auth_services'}{$param{'robot'}}}) {
$log->syslog('notice', 'SSO: %s', $sso->{'service_id'});
next unless ($sso->{'service_id'} eq $param{'service_id'});
return $sso;
# Returns the SSO record correponding to the provided service_id
# return undef if none was found
# Old name: get_sso_by_id().
sub get_auth_service {
my $robot = shift;
my $auth_type = shift;
my $service_id = shift;
if ($auth_type eq 'cas') {
return undef unless $service_id;
return [
grep {
$_->{auth_type} eq $auth_type
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;
......@@ -942,11 +952,6 @@ sub _load_auth {
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
while (<IN>) {
......@@ -1008,7 +1013,6 @@ sub _load_auth {
'Incorrect CAS paragraph in auth.conf');
next;
}
$Conf{'cas_number'}{$robot}++;
eval "require AuthCAS";
if ($EVAL_ERROR) {
......@@ -1053,26 +1057,10 @@ sub _load_auth {
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
## 'base'
$current_paragraph->{'scope'} ||= 'sub';
} 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
## 'base'
$current_paragraph->{'scope'} ||= 'sub';
......@@ -1089,13 +1077,11 @@ sub _load_auth {
if (defined $current_paragraph->{$parameter});
}
} elsif ($current_paragraph->{'auth_type'} eq 'ldap') {
$Conf{'ldap'}{$robot}++;
$Conf{'use_passwd'}{$robot} = 1;
## Force the default scope because '' is interpreted as
## 'base'
$current_paragraph->{'scope'} ||= 'sub';
} elsif ($current_paragraph->{'auth_type'} eq 'user_table') {
$Conf{'use_passwd'}{$robot} = 1;
;
}
# setting default
$current_paragraph->{'regexp'} = '.*'
......
......@@ -192,7 +192,6 @@ nobase_modules_DATA = \
Sympa/WWW/FastCGI.pm \
Sympa/WWW/Marc.pm \
Sympa/WWW/Marc/Search.pm \
Sympa/WWW/Report.pm \
Sympa/WWW/SharedDocument.pm \
Sympa/WWW/Session.pm \
Sympa/WWW/SOAP.pm \
......
......@@ -1201,7 +1201,7 @@ our %pinfo = (
group => 'sending',
gettext_id => "Attachment type",
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'],
default => 'mime'
},
......@@ -1489,7 +1489,7 @@ our %pinfo = (
order => 30.00_01,
group => 'command',
default => 'public_listmaster',
sample => 'intranet',
sample => 'listmaster',
gettext_id => 'Who is able to create lists',
gettext_comment =>
'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 {
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 {
my $self = shift;
my $flag = shift;
......
......@@ -8,8 +8,8 @@
# Copyright (c) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
# 2006, 2007, 2008, 2009, 2010, 2011 Comite Reseau des Universites
# Copyright (c) 2011, 2012, 2013, 2014, 2015, 2016, 2017 GIP RENATER
# Copyright 2018 The Sympa Community. See the AUTHORS.md file at the
# top-level directory of this distribution and at
# Copyright 2018, 2021 The Sympa Community. See the
# AUTHORS.md file at the top-level directory of this distribution and at
# <https://github.com/sympa-community/sympa.git>.
#
# This program is free software; you can redistribute it and/or modify
......@@ -210,6 +210,32 @@ Returns:
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 } )
I<Required to update database structure>.
......
......@@ -8,8 +8,8 @@
# Copyright (c) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
# 2006, 2007, 2008, 2009, 2010, 2011 Comite Reseau des Universites
# Copyright (c) 2011, 2012, 2013, 2014, 2015, 2016, 2017 GIP RENATER
# Copyright 2018, 2020 The Sympa Community. See the AUTHORS.md
# file at the top-level directory of this distribution and at
# Copyright 2018, 2020, 2021 The Sympa Community. See the
# AUTHORS.md file at the top-level directory of this distribution and at
# <https://github.com/sympa-community/sympa.git>.
#
# This program is free software; you can redistribute it and/or modify
......@@ -335,6 +335,20 @@ sub get_primary_key {
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 {
my $self = 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