fix(ogcore): restringir escritura de infraestructura a ROLE_SUPER_ADMIN

Las operaciones de creacion, edicion y eliminacion de servidores DHCP,
Boot, Subredes, Comandos y Repositorios de imagenes quedan restringidas
a ROLE_SUPER_ADMIN. Las operaciones de lectura siguen accesibles a
cualquier usuario autenticado.
pull/123/head
Nicolas Arenas 2026-05-26 15:21:02 +02:00
parent 203675e7ad
commit 6d35163b3f
5 changed files with 41 additions and 10 deletions

View File

@ -13,17 +13,22 @@ resources:
ApiPlatform\Metadata\Get:
provider: App\State\Provider\BootServerProvider
ApiPlatform\Metadata\Put:
security: 'is_granted("ROLE_SUPER_ADMIN")'
provider: App\State\Provider\BootServerProvider
ApiPlatform\Metadata\Patch:
security: 'is_granted("ROLE_SUPER_ADMIN")'
provider: App\State\Provider\BootServerProvider
ApiPlatform\Metadata\Post: ~
ApiPlatform\Metadata\Delete: ~
ApiPlatform\Metadata\Post:
security: 'is_granted("ROLE_SUPER_ADMIN")'
ApiPlatform\Metadata\Delete:
security: 'is_granted("ROLE_SUPER_ADMIN")'
oglives_sync:
shortName: BootServer
class: ApiPlatform\Metadata\Post
method: POST
input: false
security: 'is_granted("ROLE_SUPER_ADMIN")'
uriTemplate: /boot-servers/{uuid}/oglives/sync
controller: App\Controller\OgBoot\OgLive\SyncAction
@ -32,6 +37,7 @@ resources:
class: ApiPlatform\Metadata\Post
method: POST
input: false
security: 'is_granted("ROLE_SUPER_ADMIN")'
uriTemplate: /boot-servers/{uuid}/pxe-templates/sync
controller: App\Controller\OgBoot\PxeTemplate\SyncAction

View File

@ -20,11 +20,15 @@ resources:
ApiPlatform\Metadata\Get:
provider: App\State\Provider\CommandProvider
ApiPlatform\Metadata\Put:
security: 'is_granted("ROLE_SUPER_ADMIN")'
provider: App\State\Provider\CommandProvider
ApiPlatform\Metadata\Patch:
security: 'is_granted("ROLE_SUPER_ADMIN")'
provider: App\State\Provider\CommandProvider
ApiPlatform\Metadata\Post: ~
ApiPlatform\Metadata\Delete: ~
ApiPlatform\Metadata\Post:
security: 'is_granted("ROLE_SUPER_ADMIN")'
ApiPlatform\Metadata\Delete:
security: 'is_granted("ROLE_SUPER_ADMIN")'
command_execute:
class: ApiPlatform\Metadata\Post

View File

@ -15,19 +15,24 @@ resources:
provider: App\State\Provider\DhcpServerProvider
ApiPlatform\Metadata\Put:
security: 'is_granted("ROLE_SUPER_ADMIN")'
provider: App\State\Provider\DhcpServerProvider
ApiPlatform\Metadata\Patch:
security: 'is_granted("ROLE_SUPER_ADMIN")'
provider: App\State\Provider\DhcpServerProvider
ApiPlatform\Metadata\Post: ~
ApiPlatform\Metadata\Delete: ~
ApiPlatform\Metadata\Post:
security: 'is_granted("ROLE_SUPER_ADMIN")'
ApiPlatform\Metadata\Delete:
security: 'is_granted("ROLE_SUPER_ADMIN")'
subnet_sync:
shortName: DhcpServer
class: ApiPlatform\Metadata\Post
method: POST
input: false
security: 'is_granted("ROLE_SUPER_ADMIN")'
uriTemplate: /dhcp-servers/{uuid}/sync
controller: App\Controller\OgDhcp\Subnet\SyncAction

View File

@ -18,11 +18,15 @@ resources:
ApiPlatform\Metadata\Get:
provider: App\State\Provider\ImageRepositoryProvider
ApiPlatform\Metadata\Put:
security: 'is_granted("ROLE_SUPER_ADMIN")'
provider: App\State\Provider\ImageRepositoryProvider
ApiPlatform\Metadata\Patch:
security: 'is_granted("ROLE_SUPER_ADMIN")'
provider: App\State\Provider\ImageRepositoryProvider
ApiPlatform\Metadata\Post: ~
ApiPlatform\Metadata\Delete: ~
ApiPlatform\Metadata\Post:
security: 'is_granted("ROLE_SUPER_ADMIN")'
ApiPlatform\Metadata\Delete:
security: 'is_granted("ROLE_SUPER_ADMIN")'
image_ogrepository_sync:
shortName: OgRepository Server

View File

@ -17,11 +17,15 @@ resources:
ApiPlatform\Metadata\Get:
provider: App\State\Provider\SubnetProvider
ApiPlatform\Metadata\Put:
security: 'is_granted("ROLE_SUPER_ADMIN")'
provider: App\State\Provider\SubnetProvider
ApiPlatform\Metadata\Patch:
security: 'is_granted("ROLE_SUPER_ADMIN")'
provider: App\State\Provider\SubnetProvider
ApiPlatform\Metadata\Post: ~
ApiPlatform\Metadata\Delete: ~
ApiPlatform\Metadata\Post:
security: 'is_granted("ROLE_SUPER_ADMIN")'
ApiPlatform\Metadata\Delete:
security: 'is_granted("ROLE_SUPER_ADMIN")'
get_subnet:
@ -39,6 +43,7 @@ resources:
class: ApiPlatform\Metadata\Post
method: POST
input: false
security: 'is_granted("ROLE_SUPER_ADMIN")'
uriTemplate: /og-dhcp/server/{uuid}/post
controller: App\Controller\OgDhcp\Subnet\PostAction
@ -48,6 +53,7 @@ resources:
class: ApiPlatform\Metadata\Put
method: PUT
input: false
security: 'is_granted("ROLE_SUPER_ADMIN")'
uriTemplate: /og-dhcp/server/{uuid}/put
controller: App\Controller\OgDhcp\Subnet\PutAction
@ -57,6 +63,7 @@ resources:
class: ApiPlatform\Metadata\Delete
method: DELETE
input: false
security: 'is_granted("ROLE_SUPER_ADMIN")'
uriTemplate: /og-dhcp/server/{uuid}/delete
controller: App\Controller\OgDhcp\Subnet\DeleteAction
@ -66,6 +73,7 @@ resources:
class: ApiPlatform\Metadata\Post
method: POST
input: App\Dto\Input\SubnetAddHostInput
security: 'is_granted("ROLE_SUPER_ADMIN")'
uriTemplate: /og-dhcp/server/{uuid}/post-host
controller: App\Controller\OgDhcp\Subnet\PostHostAction
@ -84,6 +92,7 @@ resources:
class: ApiPlatform\Metadata\Put
method: PUT
input: false
security: 'is_granted("ROLE_SUPER_ADMIN")'
uriTemplate: /og-dhcp/server/{uuid}/put-host
controller: App\Controller\OgDhcp\Subnet\PutHostAction
@ -94,6 +103,7 @@ resources:
method: DELETE
input: false
read: false
security: 'is_granted("ROLE_SUPER_ADMIN")'
uriTemplate: /og-dhcp/server/{uuid}/delete-host/{clientUuid}
controller: App\Controller\OgDhcp\Subnet\DeleteHostAction
@ -103,6 +113,7 @@ resources:
class: ApiPlatform\Metadata\Delete
method: DELETE
input: false
security: 'is_granted("ROLE_SUPER_ADMIN")'
uriTemplate: /og-dhcp/server/{uuid}/delete-leases
controller: App\Controller\OgDhcp\Subnet\DeleteSubnetLeasesAction
@ -113,6 +124,7 @@ resources:
method: DELETE
input: false
read: false
security: 'is_granted("ROLE_SUPER_ADMIN")'
uriTemplate: /og-dhcp/server/{uuid}/delete-lease/{clientUuid}
controller: App\Controller\OgDhcp\Subnet\DeleteClientLeaseAction