|
最近用fx_auth写一个小后台,涉及到权限问题,在网站放入$this->fx_auth->check_uri_permissions();直接就报错了,报错内容如下
fx_auth报错的代码如下
function get_permissions_value($key, $array_key = 'default')
{
$result = array();
$role_id = $this->ci->session->userdata('fx_role_id');
$role_name = $this->ci->session->userdata('fx_role_name');
$parent_roles_id = $this->ci->session->userdata('fx_parent_roles_id');
$parent_roles_name = $this->ci->session->userdata('fx_parent_roles_name');
// Get current user permission
$value = $this->get_permission_value($key, FALSE);
if ($array_key == 'role_id')
{
$result[$role_id] = $value;
}
elseif ($array_key == 'role_name')
{
$result[$role_name] = $value;
}
else
{
array_push($result, $value);
}
// Get current user parent permissions
$parent_permissions = $this->ci->session->userdata('fx_parent_permissions');
$i = 0;
foreach ($parent_permissions as $permission)
{
if (array_key_exists($key, $permission))
{
$value = $permission[$key];
}
if ($array_key == 'role_id')
{
// It's safe to use $parents_roles_id[$i] because array order is same with permission array
$result[$parent_roles_id[$i]] = $value;
}
elseif ($array_key == 'role_name')
{
// It's safe to use $parents_roles_name[$i] because array order is same with permission array
$result[$parent_roles_name[$i]] = $value;
}
else
{
array_push($result, $value);
}
$i++;
}
// Trigger event
$this->ci->dx_auth_event->got_permissions_value($this->get_user_id(), $key);
return $result;
}
function get_permission_value($key, $check_parent = TRUE)
{
// Default return value
$result = NULL;
// Get current user permission
var_dump($this->ci->session->userdata);
$permission = $this->ci->session->userdata('fx_permission');
// Check if key is in user permission array
if (array_key_exists($key, $permission))
{
$result = $permission[$key];
}
// Key not found
else
{
if ($check_parent)
{
// Get current user parent permissions
$parent_permissions = $this->ci->session->userdata('fx_parent_permissions');
// Check parent permissions array
foreach ($parent_permissions as $permission)
{
if (array_key_exists($key, $permission))
{
$result = $permission[$key];
break;
}
}
}
}
// Trigger event
//$this->ci->dx_auth_event->got_permission_value($this->get_user_id(), $key);
return $result;
}
行号中的貌似都是 session的问题?我输出没任何内容,求救,最后一点了,大家帮下忙啊,谢谢了
|
|