add management of apikeys

This commit is contained in:
Uwe Steinmann 2020-06-16 12:07:46 +02:00
parent ee490b1c7f
commit 2f08d6bb7a

View File

@ -237,13 +237,52 @@ $(document).ready( function() {
$this->showUserForm($seluser);
} /* }}} */
function apikeys() { /* {{{ */
function formapikeys() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
$seluser = $this->params['seluser'];
if($seluser) {
?>
Hier die api keys
<form class="form-horizontal" action="../op/op.UsrMgr.php" method="post" name="form" id="form">
<?php
echo createHiddenFieldWithKey('addapikey');
?>
<input type="hidden" name="userid" id="userid" value="<?php print $seluser->getID();?>">
<input type="hidden" name="action" value="addapikey">
<?php
$this->formField(
getMLText("apikey"),
array(
'element'=>'input',
'type'=>'text',
'id'=>'apikey',
'name'=>'apikey',
'value'=>md5(uniqid(time())),
)
);
$this->formSubmit("<i class=\"icon-save\"></i> ".getMLText($seluser ? "save" : "add_apikey"));
}
} /* }}} */
function listapikeys() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
$seluser = $this->params['seluser'];
$apikeys = SeedDMS_Core_ApiKey::getAllInstances('expires', $dms);
if($apikeys) {
echo $this->contentHeading(getMLText('apikeys'));
echo "<table class=\"table table-condensed\">\n";
echo "<thead><tr>";
echo "<th>".getMLText('apikey')."</th>";
echo "</tr></thead><tbody>";
foreach($apikeys as $apikey) {
echo "<tr>";
echo "<td>".$apikey->getApiKey()."</td>";
echo "</tr>";
}
echo "</tbody></table>";
}
} /* }}} */
function showUserForm($currUser) { /* {{{ */
@ -643,8 +682,11 @@ Hier die api keys
<?php $this->contentContainerEnd(); ?>
<div class="span4">
<?php if($accessobject->check_view_access($this, array('action'=>'apikeys'))) { ?>
<div class="ajax" data-view="UsrMgr" data-action="apikeys" <?php echo ($seluser ? "data-query=\"userid=".$seluser->getID()."\"" : "") ?>></div>
<?php if($accessobject->check_view_access($this, array('action'=>'formapikeys'))) { ?>
<div class="ajax" data-view="UsrMgr" data-action="formapikeys" <?php echo ($seluser ? "data-query=\"userid=".$seluser->getID()."\"" : "") ?>></div>
<?php } ?>
<?php if($accessobject->check_view_access($this, array('action'=>'listapikeys'))) { ?>
<div class="ajax" data-view="UsrMgr" data-action="listapikeys" <?php echo ($seluser ? "data-query=\"userid=".$seluser->getID()."\"" : "") ?>></div>
<?php } ?>
</div>
</div>