Merge branch 'develop' into feature/user0812
This commit is contained in:
@@ -113,7 +113,7 @@ class UserController extends BaseController
|
||||
public function authorize(Request $request)
|
||||
{
|
||||
try {
|
||||
$data = $this->validate($this->service->getValidator(), $request->post(), 'authorize');
|
||||
$data = $request->post();
|
||||
$res = $this->service->authorize($request, $data);
|
||||
return $this->success([], '分配成功');
|
||||
} catch (\Throwable $e) {
|
||||
@@ -130,7 +130,7 @@ class UserController extends BaseController
|
||||
public function updateResources(Request $request)
|
||||
{
|
||||
try {
|
||||
$data = $this->validate($this->service->getValidator(), $request->post(), 'updateResources');
|
||||
$data = $request->post();
|
||||
$res = $this->service->updateResources($request, $data);
|
||||
return $this->success([], '分配成功');
|
||||
} catch (\Throwable $e) {
|
||||
|
||||
@@ -23,12 +23,16 @@ class PermLogic
|
||||
}
|
||||
|
||||
$all = collect();
|
||||
|
||||
// 合并角色资源,排除不需要权限认证的资源
|
||||
// 遍历用户的所有角色,合并每个角色所拥有的资源
|
||||
foreach ($user->roles as $role) {
|
||||
$all = $all->merge(
|
||||
// 过滤当前角色的资源列表
|
||||
$role->resources->filter(function ($resource) use($system) {
|
||||
// 只保留需要权限认证的资源(或公共资源)
|
||||
// 资源过滤条件:
|
||||
// 1. !$resource->no_auth:资源需要权限认证(排除公共资源)
|
||||
// 2. 系统匹配条件:
|
||||
// - $system->id == $resource->system_id:资源属于当前系统
|
||||
// - $resource->system_id == 0:资源为全局公共资源(所有系统可用)
|
||||
return !$resource->no_auth && ($system->id == $resource->system_id || $resource->system_id == 0);
|
||||
})
|
||||
);
|
||||
|
||||
@@ -156,8 +156,11 @@ class Generate
|
||||
protected function deleteFileIfExists($path)
|
||||
{
|
||||
if (file_exists($path)) {
|
||||
unlink($path);
|
||||
echo "删除已存在文件: <comment>{$path}</comment> \n";
|
||||
"文件: <comment>{$path}</comment> 已存在,核对后手动删除。\n";
|
||||
return;
|
||||
|
||||
// unlink($path);
|
||||
// echo "删除已存在文件: <comment>{$path}</comment> \n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user