See if this leads to the error
This commit is contained in:
@@ -115,16 +115,22 @@ class ProjectController extends Controller
|
||||
): RedirectResponse {
|
||||
|
||||
$user = $request->user();
|
||||
|
||||
abort_unless(
|
||||
$this->projectPermissionService->userCanManageProjectAccess($user, $project),
|
||||
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)
|
||||
->with('status', "{$user->name} permissions were updated.");
|
||||
->with('status', "Regular User permissions were updated.");
|
||||
}
|
||||
|
||||
public function updateTeamPermissions(
|
||||
@@ -137,7 +143,14 @@ class ProjectController extends Controller
|
||||
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)
|
||||
->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