mirror of
https://github.com/ZoneMinder/zoneminder.git
synced 2026-12-01 04:38:35 -05:00
Disabling the API per user made pages that rely on it (Montage Review and others) fail silently: the AJAX event queries came back 401 "API disabled for: <user>" and the page just drew empty boxes with no indication of why. Rather than keep a foot-gun that makes the UI look broken, drop the per-user API-disable control entirely: - AppController no longer rejects an authenticated user because APIEnabled != 1; the API is available to any authenticated user. - Remove the APIEnabled selector from the user edit view and the APIEnabled column from the users list and the API options tab. The API options tab keeps its token management (New Token, Revoke Token, Revoke All Tokens). - The user token section no longer hides itself based on APIEnabled. The Users.APIEnabled column and the model default are left in place so no database migration is needed; the value is simply no longer consulted. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
81 lines
4.9 KiB
PHP
81 lines
4.9 KiB
PHP
<?php
|
|
require_once('includes/User_Role.php');
|
|
$roles = ZM\User_Role::Indexed_By_Id();
|
|
?>
|
|
<form name="userForm" method="post" action="?">
|
|
<input type="hidden" name="view" value="<?php echo $view ?>"/>
|
|
<input type="hidden" name="tab" value="<?php echo $tab ?>"/>
|
|
<input type="hidden" name="action" value="delete"/>
|
|
<div id="options">
|
|
<div class="col button-block">
|
|
<div id="contentButtons">
|
|
<?php echo makeButton('?view=user&uid=0', 'AddNewUser', $canEdit); ?>
|
|
<button type="button" class="btn-danger" name="deleteBtn" value="Delete" data-on-click-this="DeleteUser" disabled="disabled"><?php echo translate('Delete') ?></button>
|
|
</div>
|
|
</div>
|
|
<div class="wrapper-scroll-table">
|
|
<div class="col">
|
|
<table id="contentTable"
|
|
class="table-sm table-striped"
|
|
style="display:none;"
|
|
data-click-to-select="true"
|
|
data-check-on-init="true"
|
|
data-mobile-responsive="true"
|
|
data-min-width="562"
|
|
data-show-export="true"
|
|
>
|
|
<thead class="thead-highlight">
|
|
<tr>
|
|
<th class="colMark"><?php echo translate('Mark') ?></th>
|
|
<th data-sortable="true" class="colUsername"><?php echo translate('Username') ?></th>
|
|
<th data-sortable="true" class="colEmail"><?php echo translate('Email') ?></th>
|
|
<th data-sortable="true" class="colLanguage"><?php echo translate('Language') ?></th>
|
|
<th data-sortable="true" class="colEnabled"><?php echo translate('Enabled') ?></th>
|
|
<th data-sortable="true" class="colRole"><?php echo translate('Role') ?></th>
|
|
<th data-sortable="true" class="colStream"><?php echo translate('Stream') ?></th>
|
|
<th data-sortable="true" class="colEvents"><?php echo translate('Events') ?></th>
|
|
<th data-sortable="true" class="colControl"><?php echo translate('Control') ?></th>
|
|
<th data-sortable="true" class="colMonitors"><?php echo translate('Monitors') ?></th>
|
|
<th data-sortable="true" class="colGroups"><?php echo translate('Groups') ?></th>
|
|
<th data-sortable="true" class="colSnapshots"><?php echo translate('Snapshots') ?></th>
|
|
<th data-sortable="true" class="colSystem"><?php echo translate('System') ?></th>
|
|
<th data-sortable="true" class="colDevices"><?php echo translate('Devices') ?></th>
|
|
<th data-sortable="true" class="colBandwidth"><?php echo translate('Bandwidth') ?></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php
|
|
foreach (ZM\User::find([], ['order'=>'Username']) as $user_row) {
|
|
?>
|
|
<tr>
|
|
<td class="colMark"><input type="checkbox" name="markUids[]" value="<?php echo $user_row->Id() ?>" data-on-click-this="configureDeleteButton"<?php echo (!$canEdit) ? ' disabled="disabled"' : '' ?>/></td>
|
|
<td class="colUsername"><?php echo makeLink('?view=user&uid='.$user_row->Id(), validHtmlStr($user_row->Username()).($user->Username()==$user_row->Username()?'*':''), $canEdit) ?></td>
|
|
<td class="colEmail"><?php echo $user_row->Email()?validHtmlStr($user_row->Email()):'' ?></td>
|
|
<td class="colLanguage"><?php echo $user_row->Language()?validHtmlStr($user_row->Language()):'default' ?></td>
|
|
<td class="colEnabled"><?php echo translate($user_row->Enabled()?'Yes':'No') ?></td>
|
|
<td class="colRole"><?php echo ($user_row->RoleId() && isset($roles[$user_row->RoleId()])) ? makeLink('?view=role&rid='.$user_row->RoleId(), validHtmlStr($roles[$user_row->RoleId()]->Name()), $canEdit) : '' ?></td>
|
|
<td class="colStream"><?php echo validHtmlStr($user_row->Stream()) ?></td>
|
|
<td class="colEvents"><?php echo validHtmlStr($user_row->Events()) ?></td>
|
|
<td class="colControl"><?php echo validHtmlStr($user_row->Control()) ?></td>
|
|
<td class="colMonitors"><?php echo validHtmlStr($user_row->Monitors()) ?></td>
|
|
<td class="colGroups"><?php echo validHtmlStr($user_row->Groups()) ?></td>
|
|
<td class="colSnapshots"><?php echo validHtmlStr($user_row->Snapshots()) ?></td>
|
|
<td class="colSystem"><?php echo validHtmlStr($user_row->System()) ?></td>
|
|
<td class="colDevices"><?php echo validHtmlStr($user_row->Devices()) ?></td>
|
|
<td class="colBandwidth"><?php echo $user_row->MaxBandwidth()?$bandwidth_options[$user_row->MaxBandwidth()]:' ' ?></td>
|
|
</tr>
|
|
<?php
|
|
}
|
|
?>
|
|
</tbody>
|
|
</table>
|
|
</div><!-- .col -->
|
|
</div><!-- .wrapper-scroll-table -->
|
|
</div> <!-- #options -->
|
|
<script nonce="<?php echo $cspNonce ?>">
|
|
window.addEventListener("DOMContentLoaded",
|
|
function() {
|
|
$j('#contentTable').bootstrapTable({icons: icons}).show();
|
|
});
|
|
</script></form>
|