Enforce admin privileges

This commit is contained in:
2021-06-21 20:04:16 +02:00
parent ca8a9ece18
commit 42298202d7
13 changed files with 215 additions and 117 deletions

View File

@@ -49,12 +49,30 @@
<tbody></tbody>
</table>
</div>
<h1>Users</h1>
<div id="users">
<table>
<thead>
<tr>
<th>[#]lang:id_user[#]</th>
<th>[#]lang:name[#]</th>
<th>[#]lang:language[#]</th>
<th>[#]lang:time_zone[#]</th>
<th>[#]lang:clearance[#]</th>
</tr>
</thead>
<tbody></tbody>
</table>
</div>
<h1>ToolBox</h1>
<div id="toolbox"></div>
<div id="feedback" class="feedback"></div>
</div>
<script type="text/javascript">
oSpot.pageInit = function(asHash) {
self.get('admin_get', setProjects);
$('#new').addButton('new', 'New Project', 'new', createProject, 'main-btn');
$('#toolbox').addButton('refresh', 'Update Project', 'refresh', updateProject, 'main-btn');
};
oSpot.onFeedback = function(sType, sMsg, asContext) {
@@ -116,6 +134,13 @@ function setProjects(asElemTypes) {
.append($('<td>').text(oElem.name))
.append($('<td>').text(oElem.model))
break;
case 'user':
$Elem
.append($('<td>').text(oElem.name))
.append($('<td>').text(oElem.language))
.append($('<td>').text(oElem.timezone))
.append($('<td>').text(oElem.clearance))
break;
}
$Elem.appendTo($('#'+sElemType+'s').find('table tbody'));
@@ -128,6 +153,15 @@ function createProject() {
self.get('admin_new', setProjects);
}
function updateProject() {
self.get(
'update_project',
function(asData, sMsg){oSpot.onFeedback('success', sMsg, {'update':'project'});},
{},
function(sMsg){oSpot.onFeedback('error', sMsg, {'update':'project'});}
);
}
function commit(event, $This) {
$This = $This || $(this);
if(typeof self.tmp('wait') != 'undefined') clearTimeout(self.tmp('wait'));