我正在使用代码点火器创建一个CRM系统。执行特定功能有几个角色。这两个角色是公司管理员和超级管理员。公司管理员只能为其公司创建用户。而super admin可以通过访问该公司管理员的管理面板为任何公司创建用户。当我尝试将用户添加为公司管理员时,它工作正常,但当我尝试从公司管理员添加用户时,当我点击添加用户按钮时,它会给出"当前无法处理此请求。&# 34;错误而不是加载添加用户视图
添加用户视图:
public static List<User> FilterDistinct<TKey>(this IEnumerable<User> source, Func<User, TKey> keySelector)
{
return source
.Where(x => keySelector(x) != null && keySelector(x).ToString() != string.Empty)
.GroupBy(keySelector)
.Select(g => g.First())
.ToList();
}
调用添加用户页面的控制器功能:
<main style="height: 1492px;" id="main" data-match-height="window-height" class="add-user-page">
<div class="quick-links-holder">
<div class="inner">
<ul class="quick-links clearfix">
<li>
<div style="height: 100px;" class="link" data-match-height="quick-link">
<a href="#">
<img src="<?php echo base_url(); ?>add_user_files/icon-5.png" alt="icon">
<strong>VÆRDI KORT</strong>
</a>
</div>
</li>
<li>
<div style="height: 100px;" class="link" data-match-height="quick-link">
<a href="#">
<img src="<?php echo base_url(); ?>add_user_files/icon-5.png" alt="icon">
<strong>PLAN KORT</strong>
</a>
</div>
</li>
<li>
<div style="height: 100px;" class="link" data-match-height="quick-link">
<a href="#">
<img src="<?php echo base_url(); ?>add_user_files/icon-5.png" alt="icon">
<strong>SWOT ANALYSE</strong>
</a>
</div>
</li>
<li>
<div style="height: 100px;" class="link" data-match-height="quick-link">
<a href="#">
<img src="<?php echo base_url(); ?>add_user_files/icon-5.png" alt="icon">
<strong>ACTION PROGRAM</strong>
</a>
</div>
</li>
</ul>
</div>
<a href="#" class="toggle-btn"><span>QUICK LINKS</span></a>
</div>
<div class="main-holder">
<div class="container">
<header class="title-secondary">
<h1>Users</h1>
</header>
<?php if(isset($user_success)) { ?>
<div class="notices success">
<a href="#" class="close" title="close">×</a>
<strong>Success: </strong><?php echo $user_success; ?>
</div>
<?php } ?>
<?php if(validation_errors()) { ?>
<div class="notices error">
<a href="#" class="close" title="close">×</a>
<strong>Error: </strong><?php echo validation_errors(); ?>
</div>
<?php } ?>
<div class="panel">
<div class="panel-title arrow-none btn-none">
<h3>Add User</h3>
</div>
<div class="panel-content">
<div class="inline-form">
<?php echo form_open_multipart('admin/add_user'); ?>
<fieldset>
<table>
<tbody>
<tr>
<td><label>Username</label></td>
<td><input name="username" placeholder="Username" type="text" ></td>
</tr>
<tr>
<td><label>Password</label></td>
<td><input name="password" placeholder="Password" type="password" ></td>
</tr>
<tr>
<td><label>Email</label></td>
<td><input name="email" value="abc@abc.com" placeholder="Email" type="email" ></td>
</tr>
<tr>
<td width="120"><label>First Name</label></td>
<td><input name="firstname" placeholder="First Name" type="text" ></td>
</tr>
<tr>
<td><label>Last Name</label></td>
<td><input name="lastname" placeholder="Last Name" type="text"></td>
</tr>
<tr>
<td><label>Profile Picture</label></td>
<td>
<div class="file-upload">
<input type="file" id="file" name="profile_pic" />
</div>
</td>
</tr>
<tr>
<td><label>User Role</label></td>
<td>
<label class="selectbox">
<select name="role">
<option value="administrator">Administrator</option>
<option value="employee" selected="selected">Employee</option>
</select>
</label>
</td>
</tr>
<tr>
<td colspan="2" class="text-right">
<input name="submit" class="button" value="Submit" type="submit">
</td>
</tr>
</tbody></table>
</fieldset>
</form>
</div>
</div>
</div>
</div>
</div>
加载添加用户视图的按钮:
public function adduser ($data=FALSE){
$data['logo']= $this->site_logo();
$data['company_name']=$this->site_company_name();
$data['fullname']=$this->site_user_full_name();
$data['picture']=$this->user_picture();
$data['logo']= $this->site_logo();
$data['menu'] = header_menu();
$data['dropdownItems'] = $this->TasksModel->get_dropdownItems();
$data['employees']=$this->AdminModel->load_employees();
$this->load->view('html/header',$data);
$this->load->view('add_user', $data);
$this->load->view('html/footer');
}