优化项目修复管理员登录提示权限不足报错
This commit is contained in:
@@ -85,6 +85,15 @@ class Auth
|
||||
}
|
||||
} elseif (in_array($rule, $name)) {
|
||||
$list[] = $rule;
|
||||
} else {
|
||||
// 仅勾选父级菜单(如 auth/admin)时,允许访问子路径(auth/admin/index、add 等)
|
||||
$baseRule = preg_replace('/\?.*$/U', '', $rule);
|
||||
foreach ((array) $name as $n) {
|
||||
if ($baseRule !== '' && str_starts_with((string) $n, $baseRule . '/')) {
|
||||
$list[] = $rule;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($relation === 'or' && !empty($list)) {
|
||||
|
||||
Reference in New Issue
Block a user