示例#1
0
文件: user.php 项目: rockylo/ionize
 /**
  * Edit one user
  *
  */
 public function edit()
 {
     $id_user = $this->input->post('id_user');
     $db_user = $this->user_model->get_user(array('id_user' => $id_user));
     $this->template['user'] = $db_user;
     // Panel from which the user is edited
     $this->template['from'] = $this->input->post('from');
     if ($this->current_role['role_level'] >= $db_user['role_level']) {
         // Get roles, filtered on level <= $current_role level
         $roles = $this->role_model->get_list();
         $this->template['roles'] = array_filter($roles, array($this, '_filter_roles'));
         $this->output('user/user');
     } else {
         $this->output('user/user_no_edit');
     }
 }
示例#2
0
文件: role.php 项目: trk/ionize
 /**
  * Delete
  * 
  */
 public function delete()
 {
     $id_role = $this->input->post('id_role');
     // Safe : Do not delete Role linked to users
     $nb_users = $this->user_model->count(array('user.id_role' => $id_role));
     if ($nb_users > 0) {
         $this->error(lang('ionize_message_role_no_delete_users_linked'));
     } else {
         $affected_rows = $this->role_model->delete($id_role);
         if ($affected_rows > 0) {
             // Update role list panel
             $this->_reload_role_list();
             $this->success(lang('ionize_message_role_deleted'));
         } else {
             $this->error(lang('ionize_message_role_not_deleted'));
         }
     }
 }