Implement Snapshots user permission
This commit is contained in:
parent
a07374e206
commit
7e579fd851
|
@ -681,6 +681,7 @@ CREATE TABLE `Users` (
|
|||
`Monitors` enum('None','View','Edit') NOT NULL default 'None',
|
||||
`Groups` enum('None','View','Edit') NOT NULL default 'None',
|
||||
`Devices` enum('None','View','Edit') NOT NULL default 'None',
|
||||
`Snapshots` enum('None','View','Edit') NOT NULL default 'None',
|
||||
`System` enum('None','View','Edit') NOT NULL default 'None',
|
||||
`MaxBandwidth` varchar(16),
|
||||
`MonitorIds` text,
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
--
|
||||
-- Add Snapshot permission to Users
|
||||
--
|
||||
|
||||
SET @s = (SELECT IF(
|
||||
(SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema = DATABASE()
|
||||
AND table_name = 'Users'
|
||||
AND column_name = 'Snapshots'
|
||||
) > 0,
|
||||
"SELECT 'Column Snapshots already exists in Users'",
|
||||
"ALTER TABLE `Users` ADD `Snapshots` enum('None','View','Edit') NOT NULL default 'None' AFTER `Devices`"
|
||||
));
|
||||
|
||||
PREPARE stmt FROM @s;
|
||||
EXECUTE stmt;
|
||||
|
||||
UPDATE `Users` SET `Snapshots` = `Events`;
|
|
@ -19,6 +19,7 @@ class User extends ZM_Object {
|
|||
'Monitors' => 'None',
|
||||
'Groups' => 'None',
|
||||
'Devices' => 'None',
|
||||
'Snapshots' => 'None',
|
||||
'System' => 'None',
|
||||
'MaxBandwidth' => '',
|
||||
'MonitorIds' => '',
|
||||
|
|
|
@ -151,6 +151,7 @@ $GLOBALS['defaultUser'] = array(
|
|||
'Monitors' => 'Edit',
|
||||
'Groups' => 'Edit',
|
||||
'Devices' => 'Edit',
|
||||
'Snapshots' => 'Edit',
|
||||
'System' => 'Edit',
|
||||
'MaxBandwidth' => '',
|
||||
'MonitorIds' => false
|
||||
|
|
|
@ -110,6 +110,10 @@ if ( canEdit('System') and ( $newUser->Username() != 'admin' ) ) {
|
|||
<th class="text-right" scope="row"><?php echo translate('Events') ?></th>
|
||||
<td><?php echo htmlSelect('newUser[Events]', $nve, $newUser->Events()) ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="text-right" scope="row"><?php echo translate('Snapshots') ?></th>
|
||||
<td><?php echo htmlSelect('newUser[Snapshots]', $nve, $newUser->Snapshots()) ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="text-right" scope="row"><?php echo translate('Control') ?></th>
|
||||
<td><?php echo htmlSelect('newUser[Control]', $nve, $newUser->Control()) ?></td>
|
||||
|
|
Loading…
Reference in New Issue