Example #1
0
 function index()
 {
     //
     cxp_update_cache($this->site_id);
     // $this->output->set_output('success');
     // $this->load->view('alert', $this->template_data);
     json_response(array('success' => FALSE, 'msg' => 'Success'));
 }
Example #2
0
 function delete()
 {
     check_permission('admin-del-role');
     $id = intval($this->input->get('id'));
     $this->db->trans_begin();
     $this->db->where('roleID', $id);
     $this->db->delete('role_perms');
     $this->db->where('roleID', $id);
     $this->db->delete('user_roles');
     //
     $this->db->where('id', $id);
     $this->db->delete('roles');
     $this->db->trans_complete();
     cxp_update_cache();
     json_response(array('success' => TRUE, 'msg' => 'Delete Role Success'));
 }
Example #3
0
 function set_perms()
 {
     if (strtoupper($_SERVER['REQUEST_METHOD']) === 'POST') {
         foreach ($_POST as $k => $v) {
             if (substr($k, 0, 5) == "perm_") {
                 $permID = str_replace("perm_", "", $k);
                 if ($v == 'x') {
                     $strSQL = "DELETE FROM `user_perms` WHERE `userID` = ? AND `permID` = ?";
                     $this->db->query($strSQL, array($_POST['user_id'], floatval($permID)));
                 } else {
                     $strSQL = "REPLACE INTO `user_perms` SET `userID` = ?, `permID` = ?, `value` = ?";
                     $this->db->query($strSQL, array($_POST['user_id'], floatval($permID), $v));
                 }
             }
         }
         cxp_update_cache();
         json_response(array('success' => TRUE, 'msg' => 'change user permission success'));
     } else {
         $user_id = intval($this->input->get('user_id'));
         $this->db->where('id', $user_id);
         $info = $this->db->get('users')->row();
         $this->template_data['info'] = $info;
         $this->template_data['user_id'] = $user_id;
         $this->load->view('set_perms', $this->template_data);
     }
 }