See if this leads to the error
This commit is contained in:
@@ -115,16 +115,22 @@ class ProjectController extends Controller
|
|||||||
): RedirectResponse {
|
): RedirectResponse {
|
||||||
|
|
||||||
$user = $request->user();
|
$user = $request->user();
|
||||||
|
|
||||||
abort_unless(
|
abort_unless(
|
||||||
$this->projectPermissionService->userCanManageProjectAccess($user, $project),
|
$this->projectPermissionService->userCanManageProjectAccess($user, $project),
|
||||||
403,
|
403,
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->projectPermissionService->syncUserPermissions($project, $user, $request->permissions());
|
$validated = $request->validated();
|
||||||
|
$permissions = collect(Arr::get($validated, 'permissions'))
|
||||||
|
->map(fn (mixed $permission): string => (string) $permission)
|
||||||
|
->unique()
|
||||||
|
->values()
|
||||||
|
->all();
|
||||||
|
|
||||||
|
$this->projectPermissionService->syncUserPermissions($project, $user, $permissions);
|
||||||
|
|
||||||
return to_route('projects.access', $project)
|
return to_route('projects.access', $project)
|
||||||
->with('status', "{$user->name} permissions were updated.");
|
->with('status', "Regular User permissions were updated.");
|
||||||
}
|
}
|
||||||
|
|
||||||
public function updateTeamPermissions(
|
public function updateTeamPermissions(
|
||||||
@@ -137,7 +143,14 @@ class ProjectController extends Controller
|
|||||||
403,
|
403,
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->projectPermissionService->syncTeamPermissions($project, $team, $request->permissions());
|
$validated = $request->validated();
|
||||||
|
$permissions = collect(Arr::get($validated, 'permissions'))
|
||||||
|
->map(fn (mixed $permission): string => (string) $permission)
|
||||||
|
->unique()
|
||||||
|
->values()
|
||||||
|
->all();
|
||||||
|
|
||||||
|
$this->projectPermissionService->syncTeamPermissions($project, $team, $permissions);
|
||||||
|
|
||||||
return to_route('projects.access', $project)
|
return to_route('projects.access', $project)
|
||||||
->with('status', "{$team->name} permissions were updated.");
|
->with('status', "{$team->name} permissions were updated.");
|
||||||
|
|||||||
@@ -33,13 +33,6 @@ class SyncProjectPermissionsRequest extends FormRequest
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function permissions(): array
|
|
||||||
{
|
|
||||||
return collect($this->validated('permissions', []))
|
|
||||||
->map(fn (mixed $permission): string => (string) $permission)
|
|
||||||
->unique()
|
|
||||||
->values()
|
|
||||||
->all();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user