aboutsummaryrefslogtreecommitdiffhomepage
path: root/Digitigrade/Policy.php
diff options
context:
space:
mode:
authorwinter2025-02-23 18:32:09 +0000
committerwinter2025-02-23 18:32:09 +0000
commit261ab1364aa40384b0315be60e78cd89ea7fe661 (patch)
treebf114af430c761abfaf33e814e3cf9ba0ed096d2 /Digitigrade/Policy.php
parent1ba56a5b687e6c906c2b24e5b37df119ef5752e3 (diff)
implement policies
Diffstat (limited to 'Digitigrade/Policy.php')
-rw-r--r--Digitigrade/Policy.php37
1 files changed, 37 insertions, 0 deletions
diff --git a/Digitigrade/Policy.php b/Digitigrade/Policy.php
new file mode 100644
index 0000000..56fbdb0
--- /dev/null
+++ b/Digitigrade/Policy.php
@@ -0,0 +1,37 @@
+<?php
+namespace Digitigrade;
+
+use Digitigrade\Model\Actor;
+use Digitigrade\Model\Interaction;
+use Digitigrade\Model\Note;
+
+abstract class Policy {
+ /**
+ * Checks if an Actor is allowed and possibly alters it.
+ * @param Actor $actor the actor to check (may be modified in-place)
+ * @return bool true if allowed, false if the actor should be dropped
+ */
+ public function checkActor(Actor $actor): bool {
+ return true;
+ }
+
+ /**
+ * Checks if an Interaction is allowed and possibly alters it.
+ * @param Interaction $interaction the interaction to check (may be modified in-place)
+ * @return bool true if allowed, false if the interaction should be dropped
+ */
+ public function checkInteraction(Interaction $interaction): bool {
+ return true;
+ }
+
+ /**
+ * Checks if a Note is allowed and possibly alters it.
+ * @param Note $note the note to check (may be modified in-place)
+ * @return bool true if allowed, false if the note should be dropped
+ */
+ public function checkNote(Note $note): bool {
+ return true;
+ }
+
+ // TODO: public function checkExtension()
+} \ No newline at end of file