summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/Psecio/Gatekeeper/Gatekeeper.php13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/Psecio/Gatekeeper/Gatekeeper.php b/src/Psecio/Gatekeeper/Gatekeeper.php
index e39519f..80f112b 100644
--- a/src/Psecio/Gatekeeper/Gatekeeper.php
+++ b/src/Psecio/Gatekeeper/Gatekeeper.php
@@ -578,4 +578,17 @@ class Gatekeeper
$remember = new Session\RememberMe(self::$datasource, $_COOKIE);
return $remember->verify();
}
+
+ /**
+ * Evaluate the policy (found by name) against the data provided
+ *
+ * @param string $name Name of the policy
+ * @param mixed $data Data to use in evaluation (single object or array)
+ * @return boolean Pass/fail status of evaluation
+ */
+ public static function evaluatePolicy($name, $data)
+ {
+ $policy = Gatekeeper::findPolicyByName($name);
+ return $policy->evaluate($data, $policy->expression);
+ }
} \ No newline at end of file