Skip to content

Commit

Permalink
only admin can manage plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
back2arie committed Jan 24, 2013
1 parent bfd1fe5 commit d753f58
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
10 changes: 9 additions & 1 deletion application/controllers/pluginss.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ class Pluginss extends MY_Controller {
function __construct()
{
parent::__construct();

// Prevent non-admin user
if($this->session->userdata('level') != 'admin')
{
$this->session->set_flashdata('notif', 'Only administrator can manage plugin');
redirect('/');
}

$this->load->library('Plugins');
$this->load->model('Plugin_model');
}
Expand Down Expand Up @@ -152,4 +160,4 @@ function deactivate($plugin_name)
}

/* End of file plugin.php */
/* Location: ./application/controllers/plugin.php */
/* Location: ./application/controllers/plugin.php */
7 changes: 7 additions & 0 deletions application/plugins/Plugin_Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ function Plugin_Controller($login=TRUE)
{
parent::__construct($login);

// Prevent non-admin user
if($login AND $this->session->userdata('level') != 'admin')
{
$this->session->set_flashdata('notif', 'Only administrator can manage plugin');
redirect('/');
}

/* Prevent this controller from being called directly */
if (get_class() == get_class($this))
{
Expand Down
2 changes: 1 addition & 1 deletion application/views/main/menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,6 @@
<?php if($this->config->item('sms_content')): ?>
<li id="bottom"><?php echo anchor('member','Member'); ?></li>
<?php endif; ?>
<li><?php echo anchor('pluginss', 'Plugins'); ?></li>
<?php endif; ?>
<li><?php echo anchor('pluginss', 'Plugins'); ?></li>
</ul>

0 comments on commit d753f58

Please sign in to comment.