Fixed that restricted users can see all alert templates.

This commit is contained in:
Junichi Satoh 2021-06-04 16:01:16 +09:00
parent 8976ec4b6e
commit 3563a99703
2 changed files with 8 additions and 2 deletions

View File

@ -261,7 +261,10 @@ $table->data[1][2] .= html_print_select(
);
$table->data[1][3] = html_print_select([], 'module[]', '', false, '', '', true, true, false, '', false, 'width:180px;');
$templates = alerts_get_alert_templates(false, ['id', 'name']);
$usr_groups = users_get_groups($config['id_user'], 'LW', true);
$filter_groups = '';
$filter_groups = implode(',', array_keys($usr_groups));
$templates = alerts_get_alert_templates(['id_group IN ('.$filter_groups.')'], ['id', 'name']);
$table->data[2][0] = __('Alert template');
$table->data[2][1] = html_print_select(
index_array($templates, 'id', 'name'),

View File

@ -252,7 +252,10 @@ $table->size[3] = '40%';
$table->data = [];
$templates = alerts_get_alert_templates(false, ['id', 'name']);
$usr_groups = users_get_groups($config['id_user'], 'LW', true);
$filter_groups = '';
$filter_groups = implode(',', array_keys($usr_groups));
$templates = alerts_get_alert_templates(['id_group IN ('.$filter_groups.')'], ['id', 'name']);
$table->data[0][0] = __('Alert template');
$table->data[0][1] = html_print_select(
index_array($templates, 'id', 'name'),