From a904294db09ccaa93a5b561e7cd177026010e601 Mon Sep 17 00:00:00 2001 From: winter Date: Wed, 7 May 2025 19:37:08 +0100 Subject: implement extension objects at a basic level --- Digitigrade/Policy.php | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'Digitigrade/Policy.php') diff --git a/Digitigrade/Policy.php b/Digitigrade/Policy.php index 973c229..f5ecbfb 100644 --- a/Digitigrade/Policy.php +++ b/Digitigrade/Policy.php @@ -2,6 +2,7 @@ namespace Digitigrade; use Digitigrade\Model\Actor; +use Digitigrade\Model\ExtensionObject; use Digitigrade\Model\Instance; use Digitigrade\Model\Interaction; use Digitigrade\Model\Note; @@ -34,7 +35,14 @@ abstract class Policy { return true; } - // TODO: public function checkExtension() + /** + * Checks if an ExtensionObject is allowed and possibly alters it. + * @param ExtensionObject $extension the extension to check (may be modified in-place) + * @return bool true if allowed, false if the extension should be dropped + */ + public function checkExtension(ExtensionObject $extension): bool { + return true; + } /** * Checks if an Actor is allowed to be federated to a certain Instance, @@ -59,7 +67,7 @@ abstract class Policy { } /** - * Checks if an Note is allowed to be federated to a certain Instance, + * Checks if a Note is allowed to be federated to a certain Instance, * and possibly alters it. * @param Note $note the note to check (may be modified in-place) * @param ?Instance $instance the instance that is receiving this (may be null if unknown) @@ -69,5 +77,14 @@ abstract class Policy { return true; } - // TODO: public function checkExtensionFederation() + /** + * Checks if an ExtensionObject is allowed to be federated to a certain Instance, + * and possibly alters it. + * @param ExtensionObject $extension the extension to check (may be modified in-place) + * @param ?Instance $instance the instance that is receiving this (may be null if unknown) + * @return bool true if allowed, false if the request should be cancelled + */ + public function checkExtensionFederation(ExtensionObject $extension, ?Instance $instance): bool { + return true; + } } \ No newline at end of file -- cgit v1.3