Skip to content

Commit

Permalink
Merge pull request phpmyadmin#18812 from kamyweb/role_based_auth
Browse files Browse the repository at this point in the history
Add role based auth for MySQL 8.x and compatibles
  • Loading branch information
MauricioFauth authored Mar 3, 2024
2 parents a82c7fc + 4571921 commit 856d316
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 15 deletions.
5 changes: 0 additions & 5 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -6755,11 +6755,6 @@ parameters:
count: 1
path: src/DatabaseInterface.php

-
message: "#^Only booleans are allowed in an if condition, PhpMyAdmin\\\\Dbal\\\\ResultInterface\\|false given\\.$#"
count: 2
path: src/DatabaseInterface.php

-
message: "#^Only booleans are allowed in an if condition, int\\|false given\\.$#"
count: 2
Expand Down
12 changes: 2 additions & 10 deletions src/DatabaseInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -1517,11 +1517,7 @@ public function isGrantUser(): bool
if (! $hasGrantPrivilege) {
foreach ($this->getCurrentRolesAndHost() as [$role, $roleHost]) {
$query = QueryGenerator::getInformationSchemaDataForGranteeRequest($role, $roleHost ?? '');
$result = $this->tryQuery($query);

if ($result) {
$hasGrantPrivilege = (bool) $result->numRows();
}
$hasGrantPrivilege = (bool) $this->fetchValue($query);

if ($hasGrantPrivilege) {
break;
Expand Down Expand Up @@ -1568,11 +1564,7 @@ public function isCreateUser(): bool
if (! $hasCreatePrivilege) {
foreach ($this->getCurrentRolesAndHost() as [$role, $roleHost]) {
$query = QueryGenerator::getInformationSchemaDataForCreateRequest($role, $roleHost ?? '');
$result = $this->tryQuery($query);

if ($result) {
$hasCreatePrivilege = (bool) $result->numRows();
}
$hasCreatePrivilege = (bool) $this->fetchValue($query);

if ($hasCreatePrivilege) {
break;
Expand Down

0 comments on commit 856d316

Please sign in to comment.