Skip to content

Commit

Permalink
Fixed: Could not remove database; There is no such grant defined for …
Browse files Browse the repository at this point in the history
…user...

[ci skip]
  • Loading branch information
nuxwin committed Mar 30, 2016
1 parent cdc14d2 commit 1220b0e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Expand Up @@ -42,6 +42,7 @@ FRONTEND
Fixed: Cannot add DKIM/DMARC DNS resource records
Fixed: Customer must be allowed to set custom TTL value for any DNS resource record
Fixed: Customer must be allowed to set `name` field of any DNS resource record
Fixed: Could not remove database; There is no such grant defined for user...
Fixed: IDNs are shown in IDNA form in SSL certificate management interface
Fixed: iMSCP_Update_Database::addIndex() doesn't allows to set index length
Removed: User deletion confirmation pages (admin/reseller level)
Expand Down
10 changes: 5 additions & 5 deletions gui/library/Functions/Shared.php
Expand Up @@ -652,16 +652,16 @@ function sql_delete_user($dmnId, $userId)
$row = $stmt->fetchRow(PDO::FETCH_ASSOC);

if ($row['cnt'] < 2) {
exec_query('DROP USER ?@?', array($user, $host));
exec_query('DELETE FROM mysql.user WHERE User = ? AND Host = ?', array($user, $host));
exec_query('DELETE FROM mysql.db WHERE Host = ? AND User = ?', array($host, $user));
} else {
// SQL user has privileges on many databases. We remove its privileges for the involved database only
exec_query(sprintf('REVOKE ALL PRIVILEGES ON %s.* FROM %s@%s',
quoteIdentifier($dbName), quoteValue($user), quoteValue($host)
));
exec_query('DELETE FROM mysql.db WHERE Host = ? AND Db = ? AND User = ?', array($host, $dbName, $user));
}

exec_query('DELETE FROM sql_user WHERE sqlu_id = ?', $userId);

execute_query('FLUSH PRIVILEGES');

iMSCP_Events_Aggregator::getInstance()->dispatch(iMSCP_Events::onAfterDeleteSqlUser, array(
'sqlUserId' => $userId,
'sqlUsername' => $user,
Expand Down

0 comments on commit 1220b0e

Please sign in to comment.