Ent 5316 anadir seccion credential store al menu de discovery

This commit is contained in:
Daniel Maya 2020-12-03 14:48:12 +01:00 committed by Daniel Rodriguez
parent 9aaae58cc7
commit 296cb9125e
6 changed files with 40 additions and 6 deletions

View File

@ -464,7 +464,7 @@ $data[1] = html_print_select(
$disabledBecauseInPolicy $disabledBecauseInPolicy
); );
$data[1] .= '<br> <br><a class="info_cell" href="'.ui_get_full_url('index.php?sec=gagente&sec2=godmode/groups/group_list&tab=credbox').'">'.__('Manage credentials').'</a>'; $data[1] .= '<br> <br><a class="info_cell" href="'.ui_get_full_url('index.php?sec=gmodules&sec2=godmode/groups/group_list&tab=credbox').'">'.__('Manage credentials').'</a>';
$array_os = [ $array_os = [
'inherited' => __('Inherited'), 'inherited' => __('Inherited'),

View File

@ -248,17 +248,30 @@ if (is_ajax()) {
return; return;
} }
if (! check_acl($config['id_user'], 0, 'PM')) {
$tab = (string) get_parameter('tab', 'groups');
if ($tab != 'credbox' && ! check_acl($config['id_user'], 0, 'PM')) {
db_pandora_audit( db_pandora_audit(
'ACL Violation', 'ACL Violation',
'Trying to access Group Management' 'Trying to access Group Management'
); );
include 'general/noaccess.php'; include 'general/noaccess.php';
return; return;
} else if ($tab == 'credbox'
&& !check_acl($config['id_user'], 0, 'UM')
&& !check_acl($config['id_user'], 0, 'PM')
) {
db_pandora_audit(
'ACL Violation',
'Trying to access Credential Store'
);
include 'general/noaccess.php';
return;
} }
$sec = defined('METACONSOLE') ? 'advanced' : 'gagente'; $sec = defined('METACONSOLE') ? 'advanced' : 'gagente';
$url_credbox = 'index.php?sec='.$sec.'&sec2=godmode/groups/group_list&tab=credbox'; $url_credbox = 'index.php?sec=gmodules&sec2=godmode/groups/group_list&tab=credbox';
$url_tree = 'index.php?sec='.$sec.'&sec2=godmode/groups/group_list&tab=tree'; $url_tree = 'index.php?sec='.$sec.'&sec2=godmode/groups/group_list&tab=tree';
$url_groups = 'index.php?sec='.$sec.'&sec2=godmode/groups/group_list&tab=groups'; $url_groups = 'index.php?sec='.$sec.'&sec2=godmode/groups/group_list&tab=groups';
@ -295,8 +308,6 @@ $buttons['credbox'] = [
).'</a>', ).'</a>',
]; ];
$tab = (string) get_parameter('tab', 'groups');
$title = __('Groups defined in %s', get_product_name()); $title = __('Groups defined in %s', get_product_name());
// Marks correct tab. // Marks correct tab.
switch ($tab) { switch ($tab) {

View File

@ -197,6 +197,11 @@ if (check_acl($config['id_user'], 0, 'AW')) {
$sub['gmassive']['sub2'] = $sub2; $sub['gmassive']['sub2'] = $sub2;
} }
if (check_acl($config['id_user'], 0, 'PM') || check_acl($config['id_user'], 0, 'UM')) {
$sub['godmode/groups/group_list&tab=credbox']['text'] = __('Credential store');
$sub['godmode/groups/group_list&tab=credbox']['id'] = 'credential store';
}
if (!empty($sub)) { if (!empty($sub)) {
$menu_godmode['gmodules']['text'] = __('Configuration'); $menu_godmode['gmodules']['text'] = __('Configuration');
$menu_godmode['gmodules']['sec2'] = 'godmode/modules/manage_network_templates'; $menu_godmode['gmodules']['sec2'] = 'godmode/modules/manage_network_templates';

View File

@ -1429,7 +1429,7 @@ class HostDevices extends Wizard
$available_keys = CredentialStore::getKeys('CUSTOM'); $available_keys = CredentialStore::getKeys('CUSTOM');
if (check_acl($config['id_user'], 0, 'PM')) { if (check_acl($config['id_user'], 0, 'PM')) {
$link_to_cs = '<a class="ext_link" href="'.ui_get_full_url( $link_to_cs = '<a class="ext_link" href="'.ui_get_full_url(
'index.php?sec=gagente&sec2=godmode/groups/group_list&tab=credbox' 'index.php?sec=gmodules&sec2=godmode/groups/group_list&tab=credbox'
).'" >'; ).'" >';
$link_to_cs .= __('No credentials available').', '; $link_to_cs .= __('No credentials available').', ';
$link_to_cs .= strtolower(__('Manage credentials')).'</a>'; $link_to_cs .= strtolower(__('Manage credentials')).'</a>';

View File

@ -451,6 +451,18 @@ class CredentialStore extends Wizard
$start = get_parameter('start', 0); $start = get_parameter('start', 0);
$length = get_parameter('length', $config['block_size']); $length = get_parameter('length', $config['block_size']);
$order = get_datatable_order(true); $order = get_datatable_order(true);
if ((bool) users_is_admin() === false) {
$all = users_can_manage_group_all('UM');
$filter['group_list'] = array_keys(
users_get_groups(
$config['id_user'],
'UM',
(bool) $all
)
);
}
try { try {
ob_start(); ob_start();

View File

@ -55,6 +55,11 @@ function menu_print_menu(&$menu)
} else if ($sec2 == 'godmode/servers/discovery') { } else if ($sec2 == 'godmode/servers/discovery') {
$wiz = (string) get_parameter('wiz'); $wiz = (string) get_parameter('wiz');
$sec2 = 'godmode/servers/discovery&wiz='.$wiz; $sec2 = 'godmode/servers/discovery&wiz='.$wiz;
} else if ($sec2 == 'godmode/groups/group_list') {
$tab = (string) get_parameter('tab');
if ($tab === 'credbox') {
$sec2 = 'godmode/groups/group_list&tab='.$tab;
}
} else { } else {
$sec2 = (string) get_parameter('sec2'); $sec2 = (string) get_parameter('sec2');
} }
@ -147,6 +152,7 @@ function menu_print_menu(&$menu)
$first_sub_sec2 = ''; $first_sub_sec2 = '';
foreach ($main['sub'] as $subsec2 => $sub) { foreach ($main['sub'] as $subsec2 => $sub) {
// hd($sub, true);
$count_sub++; $count_sub++;
// Init some variables. // Init some variables.