feat(access): add scoped grants for team members and API tokens (#12329)

This commit is contained in:
Andras Bacsai
2026-10-26 12:13:20 +01:00
committed by GitHub
parent 7b83fa72eb
commit 2796609e96
134 changed files with 4031 additions and 1321 deletions
@@ -165,7 +165,9 @@ class SharedEnvironmentVariablesController extends Controller
return $validated;
}
$this->authorize('create', SharedEnvironmentVariable::class);
if (in_array($type, ['team', 'server'], true)) {
$this->authorize('create', SharedEnvironmentVariable::class);
}
$scope = array_filter([
'project_id' => $attributes['project_id'] ?? null,
@@ -496,7 +498,7 @@ class SharedEnvironmentVariablesController extends Controller
return $project;
}
$this->authorize('view', $project);
$this->authorize('update', $project);
return $this->createEnv($request, $teamId, 'project', ['project_id' => $project->id]);
}
@@ -617,7 +619,7 @@ class SharedEnvironmentVariablesController extends Controller
return $environment;
}
$this->authorize('view', $project);
$this->authorize('view', $environment);
return $this->listEnvs($teamId, 'environment', ['environment_id' => $environment->id]);
}
@@ -658,7 +660,7 @@ class SharedEnvironmentVariablesController extends Controller
return $environment;
}
$this->authorize('view', $project);
$this->authorize('update', $environment);
return $this->createEnv($request, $teamId, 'environment', ['environment_id' => $environment->id]);
}
@@ -699,7 +701,7 @@ class SharedEnvironmentVariablesController extends Controller
return $environment;
}
$this->authorize('view', $project);
$this->authorize('view', $environment);
return $this->updateEnv(
$request,
@@ -745,7 +747,7 @@ class SharedEnvironmentVariablesController extends Controller
return $environment;
}
$this->authorize('view', $project);
$this->authorize('view', $environment);
return $this->deleteEnv(
$teamId,