Merge branch 'ent-9829-listado-de-dashboards-en-pantalla-de-inicio' into 'develop'

Fix list all private dashboards on user edition

See merge request artica/pandorafms!5320
This commit is contained in:
Rafael Ameijeiras 2023-01-24 11:59:23 +00:00
commit 1ed1b19cd0
3 changed files with 26 additions and 7 deletions

View File

@ -1372,7 +1372,14 @@ $home_screen .= html_print_select(
).'</div>';
$dashboards = Manager::getDashboards(-1, -1);
$dashboards = Manager::getDashboards(
-1,
-1,
false,
false,
$id_usr
);
$dashboards_aux = [];
if ($dashboards === false) {
$dashboards = ['None' => 'None'];

View File

@ -675,7 +675,8 @@ class Manager implements PublicLogin
int $offset=-1,
int $limit=-1,
bool $favourite=false,
bool $slideshow=false
bool $slideshow=false,
string $id_user=''
):array {
global $config;
@ -693,11 +694,15 @@ class Manager implements PublicLogin
$sql_where .= 'AND td.cells_slideshow = 1';
}
if (empty($id_user) === true) {
$id_user = $config['id_user'];
}
// Check ACl.
if (\is_user_admin($config['id_user']) !== true) {
if (\is_user_admin($id_user) !== true) {
// Non-admin user can see dashboards of his groups and 'AR' profile.
$group_list = \users_get_groups(
$config['id_user'],
$id_user,
'RR',
true
);
@ -727,7 +732,7 @@ class Manager implements PublicLogin
GROUP BY td.id
ORDER BY name%s",
$string_groups,
$config['id_user'],
$id_user,
$sql_where,
$sql_limit
);
@ -746,7 +751,7 @@ class Manager implements PublicLogin
WHERE td.id_group = 0 AND td.id_user = '%s' %s
GROUP BY td.id
ORDER BY name%s",
$config['id_user'],
$id_user,
$sql_where,
$sql_limit
);

View File

@ -31,6 +31,7 @@ global $config;
$headerTitle = __('User detail editor');
// Load the header.
require $config['homedir'].'/operation/users/user_edit_header.php';
use PandoraFMS\Dashboard\Manager;
if (is_metaconsole() === false) {
include 'include/javascript/timezonepicker/includes/parser.inc';
@ -442,7 +443,13 @@ if (!$meta) {
$home_screen .= html_print_select($values, 'section', io_safe_output($user_info['section']), 'show_data_section();', '', -1, true, false, false).'</div>';
$dashboards = get_user_dashboards($config['id_user']);
$dashboards = Manager::getDashboards(
-1,
-1,
false,
false,
$config['id_user']
);
$dashboards_aux = [];
if ($dashboards === false) {