Skip to content

Commit 856d316

Browse files
Merge pull request #18812 from kamyweb/role_based_auth
Add role based auth for MySQL 8.x and compatibles
2 parents a82c7fc + 4571921 commit 856d316

2 files changed

Lines changed: 2 additions & 15 deletions

File tree

‎phpstan-baseline.neon‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6755,11 +6755,6 @@ parameters:
67556755
count: 1
67566756
path: src/DatabaseInterface.php
67576757

6758-
-
6759-
message: "#^Only booleans are allowed in an if condition, PhpMyAdmin\\\\Dbal\\\\ResultInterface\\|false given\\.$#"
6760-
count: 2
6761-
path: src/DatabaseInterface.php
6762-
67636758
-
67646759
message: "#^Only booleans are allowed in an if condition, int\\|false given\\.$#"
67656760
count: 2

‎src/DatabaseInterface.php‎

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1517,11 +1517,7 @@ public function isGrantUser(): bool
15171517
if (! $hasGrantPrivilege) {
15181518
foreach ($this->getCurrentRolesAndHost() as [$role, $roleHost]) {
15191519
$query = QueryGenerator::getInformationSchemaDataForGranteeRequest($role, $roleHost ?? '');
1520-
$result = $this->tryQuery($query);
1521-
1522-
if ($result) {
1523-
$hasGrantPrivilege = (bool) $result->numRows();
1524-
}
1520+
$hasGrantPrivilege = (bool) $this->fetchValue($query);
15251521

15261522
if ($hasGrantPrivilege) {
15271523
break;
@@ -1568,11 +1564,7 @@ public function isCreateUser(): bool
15681564
if (! $hasCreatePrivilege) {
15691565
foreach ($this->getCurrentRolesAndHost() as [$role, $roleHost]) {
15701566
$query = QueryGenerator::getInformationSchemaDataForCreateRequest($role, $roleHost ?? '');
1571-
$result = $this->tryQuery($query);
1572-
1573-
if ($result) {
1574-
$hasCreatePrivilege = (bool) $result->numRows();
1575-
}
1567+
$hasCreatePrivilege = (bool) $this->fetchValue($query);
15761568

15771569
if ($hasCreatePrivilege) {
15781570
break;

0 commit comments

Comments
 (0)