Skip to content

Commit

Permalink
Fix: #6089 - Cannot Add New Users due to incorrect array structure (#…
Browse files Browse the repository at this point in the history
…6093)

* Fix: #6089 - Cannot Add New Users due to incorrect array structure

* QA: Use the get_auth_realms(true) as initially intended.

Note, Basic auth as a login realm should never happen.
  • Loading branch information
TheWitness authored Feb 7, 2025
1 parent 7fc06e9 commit db80934
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Cacti CHANGELOG

1.2.30
-issue#6089: Cannot Add New User due to incorrect array structure
-issue#6090: Undefined function warnings in Automation

1.2.29
Expand Down
4 changes: 2 additions & 2 deletions auth_login.php
Original file line number Diff line number Diff line change
Expand Up @@ -324,11 +324,11 @@
$realms = api_plugin_hook_function('login_realms',
array(
'1' => array(
'name' => __('Local'),
'name' => __('Local'),
'selected' => false
),
'2' => array(
'name' => __('LDAP'),
'name' => __('LDAP'),
'selected' => true
)
)
Expand Down
21 changes: 13 additions & 8 deletions lib/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -519,13 +519,13 @@ function get_auth_realms($login = false) {
if (cacti_sizeof($drealms)) {
if ($login) {
$new_realms['0'] = array(
'name' => __('Local'),
'name' => __('Local'),
'selected' => false
);

foreach($drealms as $realm) {
$new_realms[1000+$realm['domain_id']] = array(
'name' => $realm['domain_name'],
'name' => $realm['domain_name'],
'selected' => false
);
}
Expand All @@ -549,13 +549,18 @@ function get_auth_realms($login = false) {

return $new_realms;
}
} elseif ($login) {
return array(
'0' => array('name' => __('Local')),
'3' => array('name' => __('LDAP'))
);
} else {
return array(
'0' => __('Local'),
'3' => __('LDAP'),
'2' => __('Web Basic'),
);
}

return array(
'0' => ['name' => __('Local')],
'3' => ['name' => __('LDAP')],
'2' => ['name' => __('Web Basic')],
);
}

/**
Expand Down

0 comments on commit db80934

Please sign in to comment.