mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
webui: Disabled editing device notes for non-admin users (#5341)
This commit is contained in:
committed by
Søren Rosiak
parent
1e655c4e03
commit
36e1cc82f6
@@ -17,16 +17,20 @@ $message = 'unknown error';
|
||||
$device_id = mres($_POST['device_id']);
|
||||
$notes = $_POST['notes'];
|
||||
|
||||
if (isset($notes) && (dbUpdate(array('notes' => $notes), 'devices', 'device_id = ?', array($device_id)))) {
|
||||
if (is_admin() === false) {
|
||||
$message = 'Only admin accounts can update notes';
|
||||
} elseif (isset($notes) && (dbUpdate(array('notes' => $notes), 'devices', 'device_id = ?', array($device_id)))) {
|
||||
$status = 'ok';
|
||||
$message = 'Updated';
|
||||
} else {
|
||||
$status = 'error';
|
||||
$message = 'ERROR: Could not update';
|
||||
}
|
||||
die(json_encode(array(
|
||||
'status' => $status,
|
||||
'message' => $message,
|
||||
'notes' => $notes,
|
||||
'device_id' => $device_id
|
||||
)));
|
||||
echo _json_encode(
|
||||
array(
|
||||
'status' => $status,
|
||||
'message' => $message,
|
||||
'notes' => $notes,
|
||||
'device_id' => $device_id,
|
||||
)
|
||||
);
|
||||
|
Reference in New Issue
Block a user