Lifts role_templates / role_template_fields / user_role_assignments from fewo-webapp into oatpp-authkit, exposed via the declarative SchemaContract introduced in PR 0. New files (all in oatpp-authkit): - dto/RoleTemplateDto.hpp — RoleTemplateDto, RoleTemplateFieldDto, UserRoleAssignmentDto. UserWithPermissionsDto stays in fewo (fewo- specific /api/auth/me response shape). - db/RoleTemplateDb.hpp — DbClient with all queries (CRUD + cascade soft-delete + getEffectiveFieldPermissions). RoleTemplateSchema struct declares the three tables' columns/indexes/sidecar tables in the new declarative form. TemporalRepository overlays valid_until + the composite UNIQUE(entity_id, valid_until) index. - repo/ConcreteRoleTemplateRepository.hpp — Repository<RoleTemplateDto> inner adapter; makeRoleTemplateRepository helper composes the stack. - docs/MIGRATIONS.md — Atlas workflow for consumers (atlasgo.io as the diff-driven migration tool; SchemaBuilder produces desired state, Atlas generates versioned SQL, SchemaContract::verify asserts at runtime). - test/test_role_template_schema.cpp — verifies SchemaBuilder< RoleTemplateSchema, TemporalRepository<RoleTemplateDto>> emits the expected 5 DDL statements (2 sidecars + entity table + 2 indexes) with composite-FK + ON UPDATE CASCADE on both sidecars. 11 of 11 tests pass. RoleTemplateDto is registered as temporal via OATPP_AUTHKIT_REGISTER_TEMPORAL so TemporalRepository compiles cleanly. Atlas binary integration in CI is documented but not yet wired — owner deferred to a follow-up after the first concrete consumer migration. The shipped role_templates stack itself is fully consumable today; fewo- webapp's switch from local copies to oatpp-authkit-shipped headers is the natural next PR. Bumped 0.9.0 → 0.10.0. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
55 lines
2.1 KiB
CMake
55 lines
2.1 KiB
CMake
cmake_minimum_required(VERSION 3.14)
|
|
project(oatpp-authkit VERSION 0.10.0 LANGUAGES CXX)
|
|
|
|
# Header-only interface library — no compilation, just an include path and
|
|
# a CMake config package so consumers do:
|
|
# find_package(oatpp-authkit REQUIRED)
|
|
# target_link_libraries(app PRIVATE oatpp::authkit)
|
|
#
|
|
# Or FetchContent:
|
|
# FetchContent_Declare(oatpp-authkit GIT_REPOSITORY ... GIT_TAG v0.1.0)
|
|
# FetchContent_MakeAvailable(oatpp-authkit)
|
|
|
|
add_library(oatpp-authkit INTERFACE)
|
|
add_library(oatpp::authkit ALIAS oatpp-authkit)
|
|
|
|
target_include_directories(oatpp-authkit INTERFACE
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
|
$<INSTALL_INTERFACE:include>
|
|
)
|
|
target_compile_features(oatpp-authkit INTERFACE cxx_std_17)
|
|
|
|
# Installation
|
|
include(GNUInstallDirs)
|
|
include(CMakePackageConfigHelpers)
|
|
|
|
install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
|
install(TARGETS oatpp-authkit EXPORT oatpp-authkit-targets)
|
|
install(EXPORT oatpp-authkit-targets
|
|
FILE oatpp-authkit-targets.cmake
|
|
NAMESPACE oatpp::
|
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/oatpp-authkit)
|
|
|
|
write_basic_package_version_file(
|
|
"${CMAKE_CURRENT_BINARY_DIR}/oatpp-authkit-config-version.cmake"
|
|
VERSION ${PROJECT_VERSION}
|
|
COMPATIBILITY SameMajorVersion)
|
|
|
|
configure_package_config_file(
|
|
cmake/oatpp-authkit-config.cmake.in
|
|
"${CMAKE_CURRENT_BINARY_DIR}/oatpp-authkit-config.cmake"
|
|
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/oatpp-authkit)
|
|
|
|
install(FILES
|
|
"${CMAKE_CURRENT_BINARY_DIR}/oatpp-authkit-config.cmake"
|
|
"${CMAKE_CURRENT_BINARY_DIR}/oatpp-authkit-config-version.cmake"
|
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/oatpp-authkit)
|
|
|
|
# ─── Tests ───────────────────────────────────────────────────────────────────
|
|
# Off by default so consumers pulling us in via FetchContent don't pay the
|
|
# cost. Enable with -DOATPP_AUTHKIT_BUILD_TESTS=ON.
|
|
option(OATPP_AUTHKIT_BUILD_TESTS "Build oatpp-authkit unit tests" OFF)
|
|
if(OATPP_AUTHKIT_BUILD_TESTS)
|
|
enable_testing()
|
|
add_subdirectory(test)
|
|
endif()
|