From c953253274efb095d509963d913e776e1288ae18 Mon Sep 17 00:00:00 2001 From: provokateurin Date: Sun, 22 Dec 2024 17:55:16 +0100 Subject: [PATCH] feat: Add public capabilities Signed-off-by: provokateurin --- lib/AppInfo/Application.php | 2 ++ lib/PublicCapabilities.php | 40 +++++++++++++++++++++++++++++++++++++ openapi-administration.json | 26 ++++++++++++++++++++++++ openapi-full.json | 26 ++++++++++++++++++++++++ openapi.json | 26 ++++++++++++++++++++++++ 5 files changed, 120 insertions(+) create mode 100644 lib/PublicCapabilities.php diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index 36177d7c..45766602 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -12,6 +12,7 @@ use OCA\Registration\Events\PassedFormEvent; use OCA\Registration\Events\ShowFormEvent; use OCA\Registration\Events\ValidateFormEvent; +use OCA\TermsOfService\PublicCapabilities; use OCA\TermsOfService\Checker; use OCA\TermsOfService\Filesystem\StorageWrapper; use OCA\TermsOfService\Listener\RegistrationIntegration; @@ -51,6 +52,7 @@ public function register(IRegistrationContext $context): void { $context->registerEventListener(ShowFormEvent::class, RegistrationIntegration::class); $context->registerEventListener(ValidateFormEvent::class, RegistrationIntegration::class); $context->registerEventListener(PassedFormEvent::class, RegistrationIntegration::class); + $context->registerCapability(PublicCapabilities::class); } public function boot(IBootContext $context): void { diff --git a/lib/PublicCapabilities.php b/lib/PublicCapabilities.php new file mode 100644 index 00000000..ce52d9e6 --- /dev/null +++ b/lib/PublicCapabilities.php @@ -0,0 +1,40 @@ +config->getAppValue(Application::APPNAME, 'term_uuid'); + + return [ + 'terms_of_service' => [ + 'enabled' => true, + 'term_uuid' => $termId, + ], + ]; + } +} diff --git a/openapi-administration.json b/openapi-administration.json index 5d2d4f9d..e96000d8 100644 --- a/openapi-administration.json +++ b/openapi-administration.json @@ -88,6 +88,32 @@ } } }, + "PublicCapabilities": { + "type": "object", + "required": [ + "terms_of_service" + ], + "properties": { + "terms_of_service": { + "type": "object", + "required": [ + "enabled", + "term_uuid" + ], + "properties": { + "enabled": { + "type": "boolean", + "enum": [ + true + ] + }, + "term_uuid": { + "type": "string" + } + } + } + } + }, "Terms": { "type": "object", "required": [ diff --git a/openapi-full.json b/openapi-full.json index 49f2762b..644d2f1d 100644 --- a/openapi-full.json +++ b/openapi-full.json @@ -88,6 +88,32 @@ } } }, + "PublicCapabilities": { + "type": "object", + "required": [ + "terms_of_service" + ], + "properties": { + "terms_of_service": { + "type": "object", + "required": [ + "enabled", + "term_uuid" + ], + "properties": { + "enabled": { + "type": "boolean", + "enum": [ + true + ] + }, + "term_uuid": { + "type": "string" + } + } + } + } + }, "Terms": { "type": "object", "required": [ diff --git a/openapi.json b/openapi.json index 49afea8f..aa75d06f 100644 --- a/openapi.json +++ b/openapi.json @@ -44,6 +44,32 @@ } } }, + "PublicCapabilities": { + "type": "object", + "required": [ + "terms_of_service" + ], + "properties": { + "terms_of_service": { + "type": "object", + "required": [ + "enabled", + "term_uuid" + ], + "properties": { + "enabled": { + "type": "boolean", + "enum": [ + true + ] + }, + "term_uuid": { + "type": "string" + } + } + } + } + }, "Terms": { "type": "object", "required": [