Lifts both per-property and per-property-set RBAC tables from fewo-webapp into oatpp-authkit. Combined into one commit because they share a DbClient and the cross-table effective-permission resolver — the resolver itself stays in fewo since it joins property_set_members (a fewo-side concept). New files (all in oatpp-authkit): - dto/UserPermissionDto.hpp — UserPropertyPermissionDto + UserGroupPermissionDto, both registered as temporal. EffectivePermissionDto stays in fewo (it's the result shape of fewo's property_set_members JOIN). - db/UserPermissionDb.hpp — DbClient with CRUD for both tables. Each table also has a *Schema struct exposing kSchema for SchemaBuilder composition. Natural-key UNIQUE indexes carried explicitly: ux_..._user_property_until, ux_..._user_set_until. - repo/ConcreteUserPermissionRepository.hpp — two concrete repos + makeUserPropertyPermissionRepository / makeUserGroupPermissionRepository factories that wrap each in TemporalRepository. - test/test_user_permission_schema.cpp — verifies both schemas compose with TemporalRepository to produce the expected 5 DDL statements each (entity table + 3 schema indexes + 1 temporal composite index). 12 of 12 tests pass. Bumped 0.10.0 → 0.11.0. Per-row natural-key UNIQUE prevents duplicate live grants for the same (user_id, property_id) or (user_id, set_id) pair while still allowing historical rows for the same key (their valid_until differs). 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.11.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()
|