mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-27 07:44:04 +02:00
DbTool: Be less error-prone while calling array_search
This commit is contained in:
parent
b8293b1fdd
commit
7305edc74c
@ -816,7 +816,7 @@ EOD;
|
|||||||
// as the chances are very high that the database is created later causing the current user being
|
// as the chances are very high that the database is created later causing the current user being
|
||||||
// the owner with ALL privileges. (Which in turn can be granted to others.)
|
// the owner with ALL privileges. (Which in turn can be granted to others.)
|
||||||
|
|
||||||
if (array_search('CREATE', $privileges) !== false) {
|
if (array_search('CREATE', $privileges, true) !== false) {
|
||||||
$query = $this->query(
|
$query = $this->query(
|
||||||
'select rolcreatedb from pg_roles where rolname = :user',
|
'select rolcreatedb from pg_roles where rolname = :user',
|
||||||
array(':user' => $username !== null ? $username : $this->config['username'])
|
array(':user' => $username !== null ? $username : $this->config['username'])
|
||||||
@ -825,7 +825,7 @@ EOD;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (array_search('CREATEROLE', $privileges) !== false) {
|
if (array_search('CREATEROLE', $privileges, true) !== false) {
|
||||||
$query = $this->query(
|
$query = $this->query(
|
||||||
'select rolcreaterole from pg_roles where rolname = :user',
|
'select rolcreaterole from pg_roles where rolname = :user',
|
||||||
array(':user' => $username !== null ? $username : $this->config['username'])
|
array(':user' => $username !== null ? $username : $this->config['username'])
|
||||||
@ -833,7 +833,7 @@ EOD;
|
|||||||
$privilegesGranted &= $query->fetchColumn() !== false;
|
$privilegesGranted &= $query->fetchColumn() !== false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (array_search('SUPER', $privileges) !== false) {
|
if (array_search('SUPER', $privileges, true) !== false) {
|
||||||
$query = $this->query(
|
$query = $this->query(
|
||||||
'select rolsuper from pg_roles where rolname = :user',
|
'select rolsuper from pg_roles where rolname = :user',
|
||||||
array(':user' => $username !== null ? $username : $this->config['username'])
|
array(':user' => $username !== null ? $username : $this->config['username'])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user