Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
centreon
centreon
Commits
043e210e
Commit
043e210e
authored
May 31, 2021
by
jeremyjaouen
Committed by
Thomas Untoja
Jun 01, 2021
Browse files
fix(login): Use correct database name for api login (#9880)
parent
997f86a5
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/Centreon/Infrastructure/Security/AuthenticationRepositoryRDB.php
View file @
043e210e
...
...
@@ -58,7 +58,7 @@ class AuthenticationRepositoryRDB implements AuthenticationRepositoryInterface
{
global
$dependencyInjector
;
$pearDB
=
new
\
CentreonDB
(
$this
->
db
->
getCentreonDbName
()
,
\
CentreonDB
::
LABEL_DB_CONFIGURATION
,
3
,
true
);
...
...
www/class/centreonDB.class.php
View file @
043e210e
...
...
@@ -48,6 +48,8 @@ require_once __DIR__ . '/centreonLog.class.php';
*/
class
CentreonDB
extends
\
PDO
{
public
const
LABEL_DB_CONFIGURATION
=
'centreon'
;
public
const
LABEL_DB_REALTIME
=
'centstorage'
;
private
static
$instance
=
[];
protected
$db_type
=
"mysql"
;
protected
$db_port
=
"3306"
;
...
...
@@ -77,14 +79,14 @@ class CentreonDB extends \PDO
/**
* Constructor
*
* @param string $db | centreon, centstorage
, or ndo
* @param string $db | centreon, centstorage
* @param int $retry
* @param bool $silent | when silent is set to false, it will display an HTML error msg,
* otherwise it will throw an Exception
*
* @throws Exception
*/
public
function
__construct
(
$db
=
"centreon"
,
$retry
=
3
,
$silent
=
false
)
public
function
__construct
(
$db
=
self
::
LABEL_DB_CONFIGURATION
,
$retry
=
3
,
$silent
=
false
)
{
try
{
$conf_centreon
[
'hostCentreon'
]
=
hostCentreon
;
...
...
@@ -133,12 +135,11 @@ class CentreonDB extends \PDO
];
switch
(
strtolower
(
$db
))
{
case
"centstorage"
:
case
self
::
LABEL_DB_REALTIME
:
$this
->
dsn
[
'hostspec'
]
=
$conf_centreon
[
"hostCentstorage"
];
$this
->
dsn
[
'database'
]
=
$conf_centreon
[
"dbcstg"
];
break
;
case
"centreon"
:
case
"default"
:
default
:
$this
->
dsn
[
'hostspec'
]
=
$conf_centreon
[
"hostCentreon"
];
$this
->
dsn
[
'database'
]
=
$conf_centreon
[
"db"
];
break
;
...
...
@@ -317,9 +318,9 @@ class CentreonDB extends \PDO
* @return CentreonDB
* @throws Exception
*/
public
static
function
factory
(
$name
=
"centreon"
)
public
static
function
factory
(
$name
=
self
::
LABEL_DB_CONFIGURATION
)
{
if
(
!
in_array
(
$name
,
[
'centreon'
,
'centstorage'
,
'ndo'
]))
{
if
(
!
in_array
(
$name
,
[
self
::
LABEL_DB_CONFIGURATION
,
self
::
LABEL_DB_REALTIME
]))
{
throw
new
Exception
(
"The datasource isn't defined in configuration file."
);
}
if
(
!
isset
(
self
::
$instance
[
$name
]))
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment