Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

fix(api): require deploy ability for registry check and logout

Andras Bacsai868c0f06bfd3
diff --git a/app/Http/Controllers/Api/ServerDockerRegistriesController.php b/app/Http/Controllers/Api/ServerDockerRegistriesController.php
index 2923335dcd..5d76a1301a 100644
--- a/app/Http/Controllers/Api/ServerDockerRegistriesController.php
+++ b/app/Http/Controllers/Api/ServerDockerRegistriesController.php
@@ -231,7 +231,7 @@ class ServerDockerRegistriesController extends Controller
#[OA\Post(
summary: 'Check a registry login on a server',
- description: 'Check that the saved login of the server for a registry still works. Runs docker login with the saved credentials on the server.',
+ description: 'Check that the saved login of the server for a registry still works. Runs docker login with the saved credentials on the server. Needs a token with the write and deploy permissions.',
path: '/servers/{uuid}/registries/{registry}/check',
operationId: 'check-server-registry-login',
security: [['bearerAuth' => []]],
@@ -268,7 +268,7 @@ class ServerDockerRegistriesController extends Controller
#[OA\Delete(
summary: 'Log out from a registry on a server',
- description: 'Run docker logout on the server for a registry.',
+ description: 'Run docker logout on the server for a registry. Needs a token with the write and deploy permissions.',
path: '/servers/{uuid}/registries/{registry}',
operationId: 'logout-server-registry',
security: [['bearerAuth' => []]],
diff --git a/openapi.json b/openapi.json
index 611d8f87af..53f3325211 100644
--- a/openapi.json
+++ b/openapi.json
@@ -17000,7 +17000,7 @@
"Servers"
],
"summary": "Check a registry login on a server",
- "description": "Check that the saved login of the server for a registry still works. Runs docker login with the saved credentials on the server.",
+ "description": "Check that the saved login of the server for a registry still works. Runs docker login with the saved credentials on the server. Needs a token with the write and deploy permissions.",
"operationId": "check-server-registry-login",
"parameters": [
{
@@ -17065,7 +17065,7 @@
"Servers"
],
"summary": "Log out from a registry on a server",
- "description": "Run docker logout on the server for a registry.",
+ "description": "Run docker logout on the server for a registry. Needs a token with the write and deploy permissions.",
"operationId": "logout-server-registry",
"parameters": [
{
diff --git a/openapi.yaml b/openapi.yaml
index acaae528e9..743cf4b7ee 100644
--- a/openapi.yaml
+++ b/openapi.yaml
@@ -10824,7 +10824,7 @@ paths:
tags:
- Servers
summary: 'Check a registry login on a server'
- description: 'Check that the saved login of the server for a registry still works. Runs docker login with the saved credentials on the server.'
+ description: 'Check that the saved login of the server for a registry still works. Runs docker login with the saved credentials on the server. Needs a token with the write and deploy permissions.'
operationId: check-server-registry-login
parameters:
-
@@ -10866,7 +10866,7 @@ paths:
tags:
- Servers
summary: 'Log out from a registry on a server'
- description: 'Run docker logout on the server for a registry.'
+ description: 'Run docker logout on the server for a registry. Needs a token with the write and deploy permissions.'
operationId: logout-server-registry
parameters:
-
diff --git a/routes/api.php b/routes/api.php
index f2efce3b00..8d445c84e5 100644
--- a/routes/api.php
+++ b/routes/api.php
@@ -194,8 +194,8 @@ Route::group([
Route::get('/servers/{uuid}/registries', [ServerDockerRegistriesController::class, 'index'])->middleware(['api.ability:read:sensitive']);
Route::post('/servers/{uuid}/registries', [ServerDockerRegistriesController::class, 'login'])->middleware(['api.ability:write', 'api.ability:deploy']);
- Route::post('/servers/{uuid}/registries/{registry}/check', [ServerDockerRegistriesController::class, 'check'])->middleware(['api.ability:write']);
- Route::delete('/servers/{uuid}/registries/{registry}', [ServerDockerRegistriesController::class, 'logout'])->middleware(['api.ability:write']);
+ Route::post('/servers/{uuid}/registries/{registry}/check', [ServerDockerRegistriesController::class, 'check'])->middleware(['api.ability:write', 'api.ability:deploy']);
+ Route::delete('/servers/{uuid}/registries/{registry}', [ServerDockerRegistriesController::class, 'logout'])->middleware(['api.ability:write', 'api.ability:deploy']);
Route::get('/servers/{uuid}/proxy', [ServerProxyController::class, 'show'])->middleware(['api.ability:read']);
Route::patch('/servers/{uuid}/proxy', [ServerProxyController::class, 'update'])->middleware(['api.ability:write']);