Merge branch 'master' of https://github.com/magicbug/Cloudlog into dashboard
这个提交包含在:
当前提交
0cc7b36796
共有 3 个文件被更改,包括 26 次插入 和 4 次删除
|
|
@ -69,6 +69,20 @@ class API extends CI_Controller {
|
||||||
redirect('api/help');
|
redirect('api/help');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function delete($key) {
|
||||||
|
$this->load->model('user_model');
|
||||||
|
if(!$this->user_model->authorize(99)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); }
|
||||||
|
|
||||||
|
|
||||||
|
$this->load->model('api_model');
|
||||||
|
|
||||||
|
$this->api_model->delete_key($key);
|
||||||
|
|
||||||
|
$this->session->set_flashdata('notice', 'API Key <b>'.$key."</b> has been deleted");
|
||||||
|
|
||||||
|
redirect('api/help');
|
||||||
|
}
|
||||||
|
|
||||||
// Example of authing
|
// Example of authing
|
||||||
function auth($key) {
|
function auth($key) {
|
||||||
$this->load->model('api_model');
|
$this->load->model('api_model');
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,10 @@ class API_Model extends CI_Model {
|
||||||
return $this->db->get('api');
|
return $this->db->get('api');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function delete_key($key) {
|
||||||
|
$this->db->where('key', $key);
|
||||||
|
$this->db->delete('api');
|
||||||
|
}
|
||||||
// Generate API Key
|
// Generate API Key
|
||||||
function generate_key($rights) {
|
function generate_key($rights) {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
<?php if($this->session->flashdata('notice')) { ?>
|
<?php if($this->session->flashdata('notice')) { ?>
|
||||||
<div id="message" >
|
<div class="alert alert-success" role="alert">
|
||||||
<?php echo $this->session->flashdata('notice'); ?>
|
<?php echo $this->session->flashdata('notice'); ?>
|
||||||
</div>
|
</div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
<div class="card">
|
<div class="card">
|
||||||
|
|
@ -43,7 +43,11 @@
|
||||||
?>
|
?>
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
<td><span class="badge badge-pill badge-light"><?php echo ucfirst($row->status); ?></span> <a href="<?php echo site_url('api/auth/'.$row->key); ?>" target="_blank" class="btn btn-primary btn-sm">Test</td>
|
<td><span class="badge badge-pill badge-light"><?php echo ucfirst($row->status); ?></span>
|
||||||
|
<a href="<?php echo site_url('api/auth/'.$row->key); ?>" target="_blank" class="btn btn-primary btn-sm">Test</a>
|
||||||
|
|
||||||
|
<a href="<?php echo site_url('api/delete/'.$row->key); ?>" class="btn btn-danger btn-sm" onclick="return confirm('Are you sure you want delete API Key <?php echo $row->key; ?>?');">Delete</a>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
|
||||||
正在加载…
在新工单中引用