Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
145 commits
Select commit Hold shift + click to select a range
a3de3cb
base branch with plan
mbritense May 4, 2026
b9a3c91
v12 plan
mbritense May 5, 2026
171b3e4
update v12 plan
mbritense May 5, 2026
c45d04c
Initial version of plugin host integration
ivo-ritense May 5, 2026
f031702
Merge remote-tracking branch 'origin/story/430-external-plugin-poc' i…
ivo-ritense May 5, 2026
ca4ba08
first working version sdk, app and sample plugin
mbritense May 5, 2026
7c07d6e
first working version sdk, app and sample plugin
mbritense May 5, 2026
a3cd1e9
Merge branch 'next-minor' into story/430-external-plugin-poc
mbritense May 6, 2026
e7ecd5d
Merge branch 'next-minor' into story/430-external-plugin-poc
mbritense May 7, 2026
94963f3
Introduced 2nd plugin
ivo-ritense May 8, 2026
91879b4
imrpovements to gzac integration external plugin
mbritense May 8, 2026
30c2bac
Merge branch 'story/430-external-plugin-poc' into story/430-2nd-plugi…
ivo-ritense May 8, 2026
07e8d5d
Add gitignore
ivo-ritense May 8, 2026
deb1f8c
Fixed issue with service
ivo-ritense May 8, 2026
c09c00f
Merge branch 'next-minor' into story/430-2nd-plugin-poc
mbritense May 8, 2026
a3c5b71
Merge branch 'next-minor' into story/430-2nd-plugin-poc
mbritense May 12, 2026
430f4dd
rename sdk
mbritense May 12, 2026
a0cecda
working external plugin fe config component
mbritense May 12, 2026
c658ad1
refresh hosts
mbritense May 13, 2026
83acbf8
Merge branch 'next-minor' into story/add-external-plugin-fe
mbritense May 13, 2026
6b0103d
Merge branch 'next-minor' into story/add-external-plugin-fe
mbritense May 29, 2026
d84876d
fix prefill config and endpoint descriptors
mbritense Jun 1, 2026
182ebd6
refactors and tests
mbritense Jun 1, 2026
6fa9219
Merge branch 'next-minor' into story/external-plugin-permissions
mbritense Jun 2, 2026
422a9b1
action config, improvements
mbritense Jun 2, 2026
299caf4
edit rights
mbritense Jun 2, 2026
04f4760
Merge branch 'next-minor' into story/external-plugin-permissions
mbritense Jun 8, 2026
28d2951
improve ui, code and v13 plan
mbritense Jun 8, 2026
31ac644
working event catching
mbritense Jun 9, 2026
e88fa20
persistence with docker, update readmes
mbritense Jun 9, 2026
8d6132d
fix local dev
mbritense Jun 9, 2026
f88aa7f
hmac veriffcisation
mbritense Jun 9, 2026
526fd23
small improvements, updated plan
mbritense Jun 10, 2026
6bd175b
move event broker to host registration instead of application.yml props
mbritense Jun 10, 2026
fe51125
translation and logo support
mbritense Jun 10, 2026
183569b
v18 plan
mbritense Jun 10, 2026
fdc8323
updated plan, granted events, endpoints refactor
mbritense Jun 11, 2026
d99af0a
fix typo
mbritense Jun 11, 2026
cb73706
audit plan
mbritense Jun 12, 2026
2a3d999
remove outdated plans
mbritense Jun 12, 2026
c492e1b
Merge branch 'next-minor' into story/external-plugin-permissions
mbritense Jun 12, 2026
ae45d67
translations for title and desc. in manifest, show version for plugin…
mbritense Jun 12, 2026
fec7a87
remove dead plugins table
mbritense Jun 15, 2026
04a89f5
Merge branch 'next-minor' into feature/external-plugin-system
mbritense Jun 15, 2026
433c25b
authenticate host and config routes with hmac and adjust plan
mbritense Jun 15, 2026
e332849
secure broker credentials delivery
mbritense Jun 16, 2026
f4699cc
Merge pull request #728 from valtimo-platform/story/481-authenticate-…
mbritense Jun 16, 2026
63db749
Merge branch 'next-minor' into feature/external-plugin-system
mbritense Jun 16, 2026
ba8508d
add unique key constraints on grant tables, fix compile and test
mbritense Jun 16, 2026
c3aa686
Merge pull request #730 from valtimo-platform/story/484-unique-constr…
mbritense Jun 16, 2026
dfe92f3
check compatibility and warn when version is incompatible. fix permis…
mbritense Jun 16, 2026
92c45e0
adjust plan
mbritense Jun 17, 2026
0acb1a9
auto reconnect
mbritense Jun 17, 2026
e901281
refactor version provider
mbritense Jun 17, 2026
6d645aa
Merge pull request #736 from valtimo-platform/story/485-enforce-compa…
mbritense Jun 17, 2026
a9c4db6
Merge branch 'feature/external-plugin-system' into story/486-rabbitmq…
mbritense Jun 17, 2026
c9710c7
configurable service token ttl
mbritense Jun 17, 2026
11d25fd
Merge pull request #737 from valtimo-platform/story/486-rabbitmq-reco…
mbritense Jun 17, 2026
aecaeb3
endpoint descriptions in annotation plus test
mbritense Jun 18, 2026
2427476
Merge branch 'feature/external-plugin-system' into story/766-migrate-…
mbritense Jun 18, 2026
804cc05
Add delete guard for plugins in use. (#738)
ivo-ritense Jun 18, 2026
5a2a0a5
add missing descriptions, add to swagger
mbritense Jun 18, 2026
3fc76b5
Durable per host event queue (#744)
ivo-ritense Jun 18, 2026
ef3732e
Merge feature/external-plugin-system into story/488-configurable-serv…
mbritense Jun 19, 2026
9184eb3
Merge pull request #743 from valtimo-platform/story/488-configurable-…
mbritense Jun 19, 2026
d9895cb
Merge feature/external-plugin-system into story/766-migrate-endpoint-…
mbritense Jun 19, 2026
4542376
missing descriptions
mbritense Jun 19, 2026
12d6952
fix tesdt
mbritense Jun 25, 2026
0d7ee6e
Merge pull request #746 from valtimo-platform/story/766-migrate-endpo…
mbritense Jun 25, 2026
63dcb24
Plugin case tabs (#756)
ivo-ritense Jun 25, 2026
9aaffcd
Initial version
ivo-ritense Jun 29, 2026
ae4ced5
Merge remote-tracking branch 'origin/next-minor' into feature/externa…
mbritense Jul 6, 2026
90c7c2d
better external plugin errors
mbritense Jul 6, 2026
9c3e898
Merge pull request #780 from valtimo-platform/story/769-external-plug…
mbritense Jul 7, 2026
de904b7
wip
mbritense Jul 7, 2026
33c5bc3
wip
mbritense Jul 7, 2026
7804794
Merge branch 'feature/external-plugin-system' into story/493-task-for…
mbritense Jul 7, 2026
d77ada9
update plan, fix preview
mbritense Jul 7, 2026
6f101c2
audit improvements
mbritense Jul 8, 2026
a5ae3e6
add the possibility to configure url plugins as apps
mbritense Jul 8, 2026
93d38ef
Merge branch 'next-minor' into feature/external-plugin-system
mbritense Jul 9, 2026
96d2f8c
merge next-minor
mbritense Jul 9, 2026
1acc946
Merge branch 'next-minor' into feature/external-plugin-system
mbritense Jul 9, 2026
88dba50
Merge branch 'feature/external-plugin-system' into story/493-task-for…
mbritense Jul 9, 2026
0345879
Merge branch 'feature/external-plugin-system' into story/url-plugin
mbritense Jul 9, 2026
6368cc3
Fixes to menu page
ivo-ritense Jul 10, 2026
675319a
Merge branch 'feature/external-plugin-system' into story/plugin-page-…
mbritense Jul 10, 2026
0151671
Merge pull request #801 from valtimo-platform/story/plugin-page-in-menu
mbritense Jul 10, 2026
ff4bb3f
fix issues
mbritense Jul 10, 2026
f8e6549
Fix menu configuration seed includeFunction type
mbritense Jul 10, 2026
bfa1ba5
Merge remote-tracking branch 'origin/feature/external-plugin-system' …
mbritense Jul 10, 2026
b86b9f7
Merge remote-tracking branch 'origin/story/493-task-form-plugin-surfa…
mbritense Jul 10, 2026
2d82487
three different options for ext. plugin task forms
mbritense Jul 10, 2026
33910f9
missing files
mbritense Jul 13, 2026
668e1d8
Merge story/493-task-form-plugin-surface into story/url-plugin
mbritense Jul 13, 2026
9118c2f
Merge pull request #786 from valtimo-platform/story/493-task-form-plu…
mbritense Jul 13, 2026
d98ed1e
Merge branch 'feature/external-plugin-system' into story/url-plugin
mbritense Jul 13, 2026
1b8e54e
Merge pull request #792 from valtimo-platform/story/url-plugin
mbritense Jul 14, 2026
35d2eeb
stretch external plugin iframes to fill available viewport
mbritense Jul 15, 2026
0de3859
narrow external plugin tab CSS overrides to prevent side effects
mbritense Jul 15, 2026
80f2b8c
Merge branch 'next-minor' into feature/external-plugin-system
mbritense Jul 15, 2026
02aa8ed
partially migrate to design and fix some issues
mbritense Jul 15, 2026
d0feae2
wip impl.
mbritense Jul 16, 2026
cae9114
working logging, http, kv
mbritense Jul 16, 2026
2bbe1ce
refinements
mbritense Jul 16, 2026
7f283cd
fix double notif.
mbritense Jul 16, 2026
e934a0d
fix lists continuous refresh
mbritense Jul 16, 2026
2c5fb34
External plugin system tests (#808)
ivo-ritense Jul 20, 2026
32e0287
plugin value resolver results and use in bb
mbritense Jul 21, 2026
4a38cb5
pr comments
mbritense Jul 21, 2026
03725d2
Merge pull request #822 from valtimo-platform/story/764-implement-fig…
mbritense Jul 21, 2026
99ce856
pr comments
mbritense Jul 21, 2026
ed92bed
Merge branch 'feature/external-plugin-system' into story/494-host-cap…
mbritense Jul 21, 2026
7428748
Merge pull request #825 from valtimo-platform/story/494-host-capabili…
mbritense Jul 21, 2026
2697045
Merge remote-tracking branch 'origin/next-minor' into feature/externa…
mbritense Jul 21, 2026
1c20b78
Merge remote-tracking branch 'origin/feature/external-plugin-system' …
mbritense Jul 21, 2026
542650b
full review; adjust plan
mbritense Jul 22, 2026
f9cd3a1
improvmeents
mbritense Jul 22, 2026
f196d22
Merge remote-tracking branch 'origin/next-minor' into feature/externa…
mbritense Jul 23, 2026
82b17b2
Merge branch 'feature/external-plugin-system' into story/771-plugin-v…
mbritense Jul 23, 2026
d8d8cdf
Merge branch 'feature/external-plugin-system' into fix/external-plugi…
mbritense Jul 23, 2026
9ed4286
Enforce manifest outputs contract on action results and treat null as…
mbritense Jul 24, 2026
2155356
fix failing tests
mbritense Jul 24, 2026
f28285a
fix import error
mbritense Jul 24, 2026
ebeb67a
fix stepper title
mbritense Jul 24, 2026
f2930ce
final pr feedback
mbritense Jul 24, 2026
564d8f6
Fixed import issues
ivo-ritense Jul 28, 2026
1b41e09
Merge pull request #830 from valtimo-platform/story/771-plugin-value-…
ivo-ritense Jul 29, 2026
8b7f140
Merge remote-tracking branch 'origin/feature/external-plugin-system' …
ivo-ritense Jul 30, 2026
991cbda
Open file
ivo-ritense Jul 30, 2026
a4a4013
Discover plugin host on creation
ivo-ritense Jul 31, 2026
be4f7f3
Merge remote-tracking branch 'origin/fix/external-plugin-audit' into …
ivo-ritense Jul 31, 2026
15e3552
Removed temp test code
ivo-ritense Jul 31, 2026
e7ab845
Merge pull request #840 from valtimo-platform/fix/external-plugin-audit
mbritense Jul 31, 2026
6253bb0
Added case widget type for external plugin
ivo-ritense Jul 31, 2026
97d8995
Merge remote-tracking branch 'origin/next-minor' into feature/externa…
mbritense Aug 6, 2026
07c9e4d
security improvements plugins
mbritense Aug 6, 2026
08ef629
finalize security hardening
mbritense Aug 7, 2026
a49730e
Fixed comments
ivo-ritense Aug 7, 2026
4827053
Merge remote-tracking branch 'origin/feature/external-plugin-system' …
ivo-ritense Aug 7, 2026
d6c2b7d
minor fixes
mbritense Aug 11, 2026
2fc3dd5
Merge pull request #873 from valtimo-platform/story/external-plugin-c…
mbritense Aug 11, 2026
689e87c
Merge remote-tracking branch 'origin/feature/external-plugin-system' …
mbritense Aug 11, 2026
94325ad
Merge pull request #888 from valtimo-platform/feature/external-plugin…
mbritense Aug 11, 2026
8b06218
Merge remote-tracking branch 'origin/next-minor' into feature/externa…
mbritense Aug 11, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
137 changes: 137 additions & 0 deletions .github/workflows/plugin_host_ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
name: Plugin host & SDK - build and test

permissions:
contents: read

on:
push:
paths:
- "plugin-host/**"
- ".github/workflows/plugin_host_ci.yml"
pull_request:
paths:
- "plugin-host/**"
- ".github/workflows/plugin_host_ci.yml"
workflow_dispatch:

jobs:
unit:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

# Node 22 matches the host runtime requirement (Extism runInWorker needs Node >= 22, plan §7).
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
cache-dependency-path: |
plugin-host/plugin-sdk/package-lock.json
plugin-host/app/package-lock.json

# The SDK is a file: dependency of the app and must be built first so the app's `tsc` can
# resolve @valtimo/plugin-sdk types.
- name: SDK - install
working-directory: plugin-host/plugin-sdk
run: npm ci

- name: SDK - build (tsc)
working-directory: plugin-host/plugin-sdk
run: npm run build

- name: SDK - test
working-directory: plugin-host/plugin-sdk
run: npm run test:cov

- name: App - install
working-directory: plugin-host/app
run: npm ci

- name: App - build (tsc)
working-directory: plugin-host/app
run: npm run build

- name: App - test
working-directory: plugin-host/app
run: npm run test:cov

# L3 (Wasm/Extism) tests: compile the fixture plugin with the real SDK toolchain and run it under
# Extism. Kept separate from `unit` because it needs the extism-js compiler, which is not committed
# (plugin-host/.bin is gitignored) and is downloaded here.
wasm:
runs-on: ubuntu-latest
env:
# Pin the Extism JS PDK compiler version. Bump together with @extism/js-pdk in the fixture.
EXTISM_JS_VERSION: "1.5.1"
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
cache-dependency-path: |
plugin-host/plugin-sdk/package-lock.json
plugin-host/app/package-lock.json
plugin-host/test-fixtures/test-plugin/package-lock.json

- name: Download extism-js compiler
run: |
mkdir -p plugin-host/.bin
url="https://github.com/extism/js-pdk/releases/download/v${EXTISM_JS_VERSION}/extism-js-x86_64-linux-v${EXTISM_JS_VERSION}.gz"
curl -sSfL "$url" -o /tmp/extism-js.gz
gunzip -c /tmp/extism-js.gz > plugin-host/.bin/extism-js
chmod +x plugin-host/.bin/extism-js
plugin-host/.bin/extism-js --version

# The fixture bundles @valtimo/plugin-sdk from its built dist, so the SDK must be built first.
- name: SDK - install & build
working-directory: plugin-host/plugin-sdk
run: npm ci && npm run build

- name: Fixture - install deps
working-directory: plugin-host/test-fixtures/test-plugin
run: npm install

- name: App - install
working-directory: plugin-host/app
run: npm ci

# globalSetup compiles the fixture to Wasm (finds extism-js on PATH via plugin-host/.bin).
- name: App - Wasm/Extism tests (L3)
working-directory: plugin-host/app
run: npm run test:wasm

# L4 (integration) tests: real Postgres + RabbitMQ via Testcontainers. The ubuntu runner ships a
# working Docker daemon, which Testcontainers uses directly.
integration:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
cache-dependency-path: |
plugin-host/plugin-sdk/package-lock.json
plugin-host/app/package-lock.json

# The app's tsc/type surface pulls @valtimo/plugin-sdk, so build the SDK first.
- name: SDK - install & build
working-directory: plugin-host/plugin-sdk
run: npm ci && npm run build

- name: App - install
working-directory: plugin-host/app
run: npm ci

- name: App - integration tests (Testcontainers)
working-directory: plugin-host/app
run: npm run test:int
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,16 @@ import com.ritense.adminsettings.importer.AdminSettingsLogoImporter
import com.ritense.adminsettings.repository.AccentColorsRepository
import com.ritense.adminsettings.repository.AdminSettingsLogoRepository
import com.ritense.adminsettings.repository.FeatureToggleOverridesRepository
import com.ritense.adminsettings.repository.MenuConfigurationRepository
import com.ritense.adminsettings.security.config.AdminSettingsHttpSecurityConfigurer
import com.ritense.adminsettings.service.AccentColorsService
import com.ritense.adminsettings.service.AdminSettingsLogoService
import com.ritense.adminsettings.service.FeatureToggleOverridesService
import com.ritense.adminsettings.service.MenuConfigurationService
import com.ritense.adminsettings.web.rest.AccentColorsResource
import com.ritense.adminsettings.web.rest.AdminSettingsLogoResource
import com.ritense.adminsettings.web.rest.FeatureToggleOverridesResource
import com.ritense.adminsettings.web.rest.MenuConfigurationResource
import com.ritense.authorization.AuthorizationService
import org.springframework.boot.autoconfigure.AutoConfiguration
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
Expand All @@ -39,7 +42,7 @@ import org.springframework.core.annotation.Order
import org.springframework.data.jpa.repository.config.EnableJpaRepositories

@AutoConfiguration
@EnableJpaRepositories(basePackageClasses = [AdminSettingsLogoRepository::class, FeatureToggleOverridesRepository::class, AccentColorsRepository::class])
@EnableJpaRepositories(basePackageClasses = [AdminSettingsLogoRepository::class, FeatureToggleOverridesRepository::class, AccentColorsRepository::class, MenuConfigurationRepository::class])
@EntityScan(basePackages = ["com.ritense.adminsettings.domain"])
class AdminSettingsAutoConfiguration {

Expand Down Expand Up @@ -110,6 +113,26 @@ class AdminSettingsAutoConfiguration {
return AccentColorsResource(accentColorsService)
}

@Bean
@ConditionalOnMissingBean(MenuConfigurationService::class)
fun menuConfigurationService(
menuConfigurationRepository: MenuConfigurationRepository,
objectMapper: ObjectMapper,
): MenuConfigurationService {
return MenuConfigurationService(
menuConfigurationRepository,
objectMapper,
)
}

@Bean
@ConditionalOnMissingBean(MenuConfigurationResource::class)
fun menuConfigurationResource(
menuConfigurationService: MenuConfigurationService
): MenuConfigurationResource {
return MenuConfigurationResource(menuConfigurationService)
}

@Bean
@ConditionalOnMissingBean(AdminSettingsFeatureToggleImporter::class)
fun adminSettingsFeatureToggleImporter(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright 2015-2026 Ritense BV, the Netherlands.
*
* Licensed under EUPL, Version 1.2 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.ritense.adminsettings.domain

import jakarta.persistence.Column
import jakarta.persistence.Entity
import jakarta.persistence.Id
import jakarta.persistence.Table

/**
* Singleton row holding the application's left-hand menu structure as opaque, frontend-owned JSON
* (exactly like [AccentColors] holds colours). The backend never interprets the structure; the
* frontend resolves it against its catalog registry at startup.
*/
@Entity
@Table(name = "admin_settings_menu_configuration")
open class MenuConfiguration(

@Id
@Column(name = "id", nullable = false)
open val id: String = SINGLETON_ID,

@Column(name = "configuration", columnDefinition = "TEXT", nullable = false)
open var configuration: String = "{}"
) {

companion object {
const val SINGLETON_ID = "singleton"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Copyright 2015-2026 Ritense BV, the Netherlands.
*
* Licensed under EUPL, Version 1.2 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.ritense.adminsettings.repository

import com.ritense.adminsettings.domain.MenuConfiguration
import org.springframework.data.jpa.repository.JpaRepository

interface MenuConfigurationRepository : JpaRepository<MenuConfiguration, String>
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ class AdminSettingsHttpSecurityConfigurer : HttpSecurityConfigurer {
.authenticated()
.requestMatchers(antMatcher(PUT, "/api/management/v1/admin-settings/accent-colors"))
.hasAuthority(ADMIN)
.requestMatchers(antMatcher(GET, "/api/v1/admin-settings/menu-configuration"))
.authenticated()
.requestMatchers(antMatcher(PUT, "/api/management/v1/admin-settings/menu-configuration"))
.hasAuthority(ADMIN)
}
} catch (e: Exception) {
throw HttpConfigurerConfigurationException(e)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/*
* Copyright 2015-2026 Ritense BV, the Netherlands.
*
* Licensed under EUPL, Version 1.2 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.ritense.adminsettings.service

import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.ObjectMapper
import com.ritense.adminsettings.domain.MenuConfiguration
import com.ritense.adminsettings.domain.MenuConfiguration.Companion.SINGLETON_ID
import com.ritense.adminsettings.repository.MenuConfigurationRepository
import com.ritense.adminsettings.web.rest.dto.MenuConfigurationDto
import org.springframework.data.repository.findByIdOrNull
import org.springframework.http.HttpStatus
import org.springframework.transaction.annotation.Transactional
import org.springframework.web.server.ResponseStatusException

open class MenuConfigurationService(
private val menuConfigurationRepository: MenuConfigurationRepository,
private val objectMapper: ObjectMapper,
) {

@Transactional(readOnly = true)
open fun getMenuConfiguration(): MenuConfigurationDto {
val entity = menuConfigurationRepository.findByIdOrNull(SINGLETON_ID)
val configuration: JsonNode = if (entity != null) {
objectMapper.readTree(entity.configuration)
} else {
objectMapper.createObjectNode()
}
return MenuConfigurationDto(configuration)
}

@Transactional
open fun updateMenuConfiguration(configuration: JsonNode): MenuConfigurationDto {
val serializedConfiguration = objectMapper.writeValueAsString(configuration)
if (serializedConfiguration.length > MAX_CONFIGURATION_LENGTH) {
throw ResponseStatusException(
HttpStatus.BAD_REQUEST,
"Menu configuration exceeds the maximum size of $MAX_CONFIGURATION_LENGTH characters"
)
}

val entity = menuConfigurationRepository.findByIdOrNull(SINGLETON_ID)
?: MenuConfiguration()

entity.configuration = serializedConfiguration
menuConfigurationRepository.save(entity)

return MenuConfigurationDto(configuration)
}

companion object {
const val MAX_CONFIGURATION_LENGTH = 100_000
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import com.ritense.adminsettings.service.AccentColorsService
import com.ritense.adminsettings.web.rest.dto.AccentColorsDto
import com.ritense.valtimo.contract.annotation.SkipComponentScan
import com.ritense.valtimo.contract.domain.ValtimoMediaType.APPLICATION_JSON_UTF8_VALUE
import com.ritense.valtimo.contract.endpoint.EndpointDescription
import jakarta.validation.Valid
import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.GetMapping
Expand All @@ -35,11 +36,19 @@ class AccentColorsResource(
private val accentColorsService: AccentColorsService
) {

@EndpointDescription(
en = "Get accent colors",
nl = "Accentkleuren ophalen",
)
@GetMapping("/v1/admin-settings/accent-colors")
fun getColors(): ResponseEntity<AccentColorsDto> {
return ResponseEntity.ok(accentColorsService.getColors())
}

@EndpointDescription(
en = "Update accent colors",
nl = "Accentkleuren bijwerken",
)
@PutMapping("/management/v1/admin-settings/accent-colors")
fun updateColors(
@Valid @RequestBody dto: AccentColorsDto
Expand Down
Loading
Loading