aboutsummaryrefslogtreecommitdiffhomepage
path: root/Digitigrade/Policy.php
diff options
context:
space:
mode:
authorwinter2025-02-24 18:29:51 +0000
committerwinter2025-02-24 18:29:51 +0000
commita88283c526a779389efa2b819201a2331de0f2b2 (patch)
tree684e6aa432d6062373941e3018dfc744adc03ff5 /Digitigrade/Policy.php
parent261ab1364aa40384b0315be60e78cd89ea7fe661 (diff)
implement federation policies and instance info substitution policy
Diffstat (limited to 'Digitigrade/Policy.php')
-rw-r--r--Digitigrade/Policy.php36
1 files changed, 36 insertions, 0 deletions
diff --git a/Digitigrade/Policy.php b/Digitigrade/Policy.php
index 56fbdb0..973c229 100644
--- a/Digitigrade/Policy.php
+++ b/Digitigrade/Policy.php
@@ -2,6 +2,7 @@
namespace Digitigrade;
use Digitigrade\Model\Actor;
+use Digitigrade\Model\Instance;
use Digitigrade\Model\Interaction;
use Digitigrade\Model\Note;
@@ -34,4 +35,39 @@ abstract class Policy {
}
// TODO: public function checkExtension()
+
+ /**
+ * Checks if an Actor is allowed to be federated to a certain Instance,
+ * and possibly alters it.
+ * @param Actor $actor the actor 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 checkActorFederation(Actor $actor, ?Instance $instance): bool {
+ return true;
+ }
+
+ /**
+ * Checks if an Interaction is allowed to be federated to a certain Instance,
+ * and possibly alters it.
+ * @param Interaction $interaction the interaction 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 checkInteractionFederation(Interaction $interaction, ?Instance $instance): bool {
+ return true;
+ }
+
+ /**
+ * Checks if an 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)
+ * @return bool true if allowed, false if the request should be cancelled
+ */
+ public function checkNoteFederation(Note $note, ?Instance $instance): bool {
+ return true;
+ }
+
+ // TODO: public function checkExtensionFederation()
} \ No newline at end of file