# You should have received a copy of the GNU General Public License
# along with Koha; if not, see <http://www.gnu.org/licenses>.
-use strict;
-use warnings;
+use Modern::Perl;
use diagnostics;
use C4::InstallAuth;
$template->param( 'checkdatabasecreated' => 1 );
}
- #Check if user have all necessary grants on this database.
- my $rq =
- $dbh->prepare(
- "SHOW GRANTS FOR \'$info{user}\'\@'$info{hostname}'");
+ # Check if user have all necessary grants on this database.
+ # CURRENT_USER is ANSI SQL, and doesn't require mysql table
+ # privileges, making the % check pointless, since they
+ # couldn't even check GRANTS if they couldn't connect.
+ my $rq = $dbh->prepare('SHOW GRANTS FOR CURRENT_USER');
$rq->execute;
my $grantaccess;
while ( my ($line) = $rq->fetchrow ) {
);
}
}
- unless ($grantaccess) {
- $rq =
- $dbh->prepare("SHOW GRANTS FOR \'$info{user}\'\@'\%'");
- $rq->execute;
- while ( my ($line) = $rq->fetchrow ) {
- my $dbname = $info{dbname};
- if ( $line =~ m/$dbname/ || index( $line, '*.*' ) > 0 )
- {
- $grantaccess = 1
- if (
- index( $line, 'ALL PRIVILEGES' ) > 0
- || ( ( index( $line, 'SELECT' ) > 0 )
- && ( index( $line, 'INSERT' ) > 0 )
- && ( index( $line, 'UPDATE' ) > 0 )
- && ( index( $line, 'DELETE' ) > 0 )
- && ( index( $line, 'CREATE' ) > 0 )
- && ( index( $line, 'DROP' ) > 0 ) )
- );
- }
- }
- }
$template->param( "checkgrantaccess" => $grantaccess );
} # End mysql connect check...
# Where <level> is a category of requirement : required, recommended optional
# level should contain :
# SQL File for import With a readable name.
-# txt File taht explains what this SQL File is meant for.
+# txt File that explains what this SQL File is meant for.
# Could be VERY useful to have A Big file for a kind of library.
# But could also be useful to have some Authorised values data set prepared here.
# Marcflavour Selection is achieved through radiobuttons.