2019-02-06 11:36:28 +01:00
|
|
|
<?php
|
2019-04-24 13:53:18 +02:00
|
|
|
/**
|
|
|
|
* Extension to manage a list of gateways and the node address where they should
|
|
|
|
* point to.
|
|
|
|
*
|
|
|
|
* @category Users
|
|
|
|
* @package Pandora FMS
|
|
|
|
* @subpackage Community
|
|
|
|
* @version 1.0.0
|
|
|
|
* @license See below
|
|
|
|
*
|
|
|
|
* ______ ___ _______ _______ ________
|
|
|
|
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
|
|
|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
|
|
|
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
|
|
|
*
|
|
|
|
* ============================================================================
|
|
|
|
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
|
|
|
|
* Please see http://pandorafms.org for full contribution list
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation for version 2.
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
* ============================================================================
|
|
|
|
*/
|
2019-02-06 11:36:28 +01:00
|
|
|
|
|
|
|
global $config;
|
|
|
|
|
2019-02-06 12:51:02 +01:00
|
|
|
check_login();
|
2019-02-06 11:36:28 +01:00
|
|
|
|
|
|
|
enterprise_hook('open_meta_frame');
|
|
|
|
|
2019-02-06 12:51:02 +01:00
|
|
|
require_once $config['homedir'].'/include/functions_profile.php';
|
|
|
|
require_once $config['homedir'].'/include/functions_users.php';
|
|
|
|
require_once $config['homedir'].'/include/functions_groups.php';
|
|
|
|
require_once $config['homedir'].'/include/functions_visual_map.php';
|
2019-02-06 11:36:28 +01:00
|
|
|
|
|
|
|
$meta = false;
|
2019-02-06 12:51:02 +01:00
|
|
|
if (enterprise_installed() && defined('METACONSOLE')) {
|
|
|
|
$meta = true;
|
2019-02-06 11:36:28 +01:00
|
|
|
}
|
|
|
|
|
2019-02-06 12:51:02 +01:00
|
|
|
$id = get_parameter_get('id', $config['id_user']);
|
2019-04-24 13:53:18 +02:00
|
|
|
// ID given as parameter.
|
2019-02-06 12:51:02 +01:00
|
|
|
$status = get_parameter('status', -1);
|
2019-04-24 13:53:18 +02:00
|
|
|
// Flag to print action status message.
|
2019-02-06 12:51:02 +01:00
|
|
|
$user_info = get_user_info($id);
|
|
|
|
$id = $user_info['id_user'];
|
2019-04-24 13:53:18 +02:00
|
|
|
// This is done in case there are problems
|
|
|
|
// with uppercase/lowercase (MySQL auth has that problem).
|
2019-02-06 12:51:02 +01:00
|
|
|
if ((!check_acl($config['id_user'], users_get_groups($id), 'UM'))
|
2019-04-24 13:53:18 +02:00
|
|
|
&& ($id != $config['id_user'])
|
2019-02-06 12:51:02 +01:00
|
|
|
) {
|
2019-04-24 13:53:18 +02:00
|
|
|
db_pandora_audit(
|
|
|
|
'ACL Violation',
|
|
|
|
'Trying to view a user without privileges'
|
|
|
|
);
|
2019-02-06 12:51:02 +01:00
|
|
|
include 'general/noaccess.php';
|
|
|
|
exit;
|
2019-02-06 11:36:28 +01:00
|
|
|
}
|
|
|
|
|
2019-04-24 13:53:18 +02:00
|
|
|
// If current user is editing himself or if the user has UM (User Management)
|
|
|
|
// rights on any groups the user is part of AND the authorization scheme
|
|
|
|
// allows for users/admins to update info.
|
|
|
|
if (($config['id_user'] == $id
|
|
|
|
|| check_acl($config['id_user'], users_get_groups($id), 'UM'))
|
|
|
|
&& $config['user_can_update_info']
|
|
|
|
) {
|
2019-02-06 12:51:02 +01:00
|
|
|
$view_mode = false;
|
|
|
|
} else {
|
|
|
|
$view_mode = true;
|
2019-02-06 11:36:28 +01:00
|
|
|
}
|
|
|
|
|
2019-02-06 12:51:02 +01:00
|
|
|
$urls = [];
|
2019-02-06 11:36:28 +01:00
|
|
|
if (is_metaconsole()) {
|
2019-02-06 12:51:02 +01:00
|
|
|
user_meta_print_header();
|
|
|
|
$urls['main'] = 'index.php?sec=advanced&sec2=advanced/users_setup&tab=user_edit';
|
|
|
|
} else {
|
|
|
|
$urls['main'] = 'index.php?sec=workspace&sec2=operation/users/user_edit';
|
|
|
|
$urls['notifications'] = 'index.php?sec=workspace&sec2=operation/users/user_edit_notifications';
|
|
|
|
$buttons = [
|
|
|
|
'main' => [
|
|
|
|
'active' => $_GET['sec2'] === 'operation/users/user_edit',
|
|
|
|
'text' => "<a href='{$urls['main']}'>".html_print_image(
|
|
|
|
'images/user_green.png',
|
|
|
|
true,
|
|
|
|
['title' => __('User management')]
|
|
|
|
).'</a>',
|
|
|
|
],
|
|
|
|
'notifications' => [
|
|
|
|
'active' => $_GET['sec2'] === 'operation/users/user_edit_notifications',
|
|
|
|
'text' => "<a href='{$urls['notifications']}'>".html_print_image(
|
|
|
|
'images/alerts_template.png',
|
|
|
|
true,
|
|
|
|
['title' => __('User notifications')]
|
|
|
|
).'</a>',
|
|
|
|
],
|
|
|
|
];
|
|
|
|
|
2019-04-24 13:53:18 +02:00
|
|
|
$helpers = '';
|
|
|
|
if ($_GET['sec2'] === 'operation/users/user_edit_notifications') {
|
|
|
|
$helpers = 'user_edit_notifications';
|
|
|
|
}
|
|
|
|
|
2019-02-06 12:51:02 +01:00
|
|
|
ui_print_page_header(
|
|
|
|
__('User detail editor'),
|
|
|
|
'images/op_workspace.png',
|
|
|
|
false,
|
2019-04-24 13:53:18 +02:00
|
|
|
$helpers,
|
2019-02-06 12:51:02 +01:00
|
|
|
false,
|
|
|
|
$buttons
|
|
|
|
);
|
2019-02-06 11:36:28 +01:00
|
|
|
}
|