Added new window to display user notifications config

Former-commit-id: 57ba8fcd01365cedc92535d7cf71f70432a55a94
This commit is contained in:
fermin831 2019-02-06 11:36:28 +01:00
parent ddcf0bbd16
commit ac6b74dcdf
4 changed files with 129 additions and 48 deletions

View File

@ -374,6 +374,11 @@ $sub["operation/users/user_edit"]["text"] = __('Edit my user');
$sub["operation/users/user_edit"]["id"] = 'Edit my user';
$sub["operation/users/user_edit"]["refr"] = 0;
// Users
$sub["operation/users/user_edit_notifications"]["text"] = __('Configure user notifications');
$sub["operation/users/user_edit_notifications"]["id"] = 'Configure user notifications';
$sub["operation/users/user_edit_notifications"]["refr"] = 0;
// ANY user can chat with other user and dogs.
// Users
$sub["operation/users/webchat"]["text"] = __('WebChat');

View File

@ -13,56 +13,11 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Load global vars
global $config;
check_login ();
enterprise_hook('open_meta_frame');
include_once($config['homedir'] . "/include/functions_profile.php");
include_once($config['homedir'] . '/include/functions_users.php');
include_once ($config['homedir'] . '/include/functions_groups.php');
include_once ($config['homedir'] . '/include/functions_visual_map.php');
$meta = false;
if (enterprise_installed() && defined("METACONSOLE")) {
$meta = true;
}
$id = get_parameter_get ("id", $config["id_user"]); // ID given as parameter
$status = get_parameter ("status", -1); // Flag to print action status message
$user_info = get_user_info ($id);
$id = $user_info["id_user"]; //This is done in case there are problems with uppercase/lowercase (MySQL auth has that problem)
if ((!check_acl ($config["id_user"], users_get_groups ($id), "UM"))
AND ($id != $config["id_user"])) {
db_pandora_audit("ACL Violation","Trying to view a user without privileges");
require ("general/noaccess.php");
exit;
}
//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"]) {
$view_mode = false;
}
else {
$view_mode = true;
}
// Header
if ($meta) {
user_meta_print_header();
$url = 'index.php?sec=advanced&sec2=advanced/users_setup&tab=user_edit';
}
else {
ui_print_page_header (__('User detail editor'), "images/op_workspace.png", false, "", false, "");
$url = 'index.php?sec=workspace&sec2=operation/users/user_edit';
}
// Load the header
require($config['homedir'] . "/operation/users/user_edit_header.php");
// Update user info
if (isset ($_GET["modified"]) && !$view_mode) {
@ -525,7 +480,7 @@ $table->rowclass[] = '';
$table->rowstyle[] = '';
$table->data[] = $data;
echo '<form name="user_mod" method="post" action="'.$url.'&amp;modified=1&amp;id='.$id.'&amp;pure='.$config['pure'].'">';
echo '<form name="user_mod" method="post" action="'.$urls['main'].'&amp;modified=1&amp;id='.$id.'&amp;pure='.$config['pure'].'">';
html_print_table($table);

View File

@ -0,0 +1,97 @@
<?php
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2010 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.
// Load global vars
global $config;
check_login ();
enterprise_hook('open_meta_frame');
include_once($config['homedir'] . "/include/functions_profile.php");
include_once($config['homedir'] . '/include/functions_users.php');
include_once ($config['homedir'] . '/include/functions_groups.php');
include_once ($config['homedir'] . '/include/functions_visual_map.php');
$meta = false;
if (enterprise_installed() && defined("METACONSOLE")) {
$meta = true;
}
$id = get_parameter_get ("id", $config["id_user"]); // ID given as parameter
$status = get_parameter ("status", -1); // Flag to print action status message
$user_info = get_user_info ($id);
$id = $user_info["id_user"]; //This is done in case there are problems with uppercase/lowercase (MySQL auth has that problem)
if ((!check_acl ($config["id_user"], users_get_groups ($id), "UM"))
AND ($id != $config["id_user"])) {
db_pandora_audit("ACL Violation","Trying to view a user without privileges");
require ("general/noaccess.php");
exit;
}
//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"]) {
$view_mode = false;
}
else {
$view_mode = true;
}
$urls = array();
if (is_metaconsole()) {
user_meta_print_header();
$urls['main'] = 'index.php?sec=advanced&amp;sec2=advanced/users_setup&amp;tab=user_edit';
}
else {
$urls['main'] = "index.php?sec=workspace&amp;sec2=operation/users/user_edit";
$urls['notifications'] = "index.php?sec=workspace&amp;sec2=operation/users/user_edit_notifications";
$buttons = array(
'main' => array(
'active' => $_GET['sec2'] === 'operation/users/user_edit',
'text' =>
"<a href='{$urls['main']}'>".
html_print_image (
"images/user_green.png",
true,
array ("title" => __('User management'))
).'</a>'
),
'notifications' => array(
'active' => $_GET['sec2'] === 'operation/users/user_edit_notifications',
'text' =>
"<a href='{$urls['notifications']}'>".
html_print_image (
"images/alerts_template.png",
true,
array ("title" => __('User notifications'))
).'</a>'
)
);
ui_print_page_header (
__('User detail editor'),
"images/op_workspace.png",
false,
"",
false,
$buttons
);
}
?>

View File

@ -0,0 +1,24 @@
<?php
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2010 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.
// Load global vars
global $config;
// Load the header
require($config['homedir'] . "/operation/users/user_edit_header.php");
// TODO
?>