summaryrefslogtreecommitdiff
path: root/core/helpers/access.php
diff options
context:
space:
mode:
Diffstat (limited to 'core/helpers/access.php')
-rw-r--r--core/helpers/access.php13
1 files changed, 13 insertions, 0 deletions
diff --git a/core/helpers/access.php b/core/helpers/access.php
index ab113375..c6ee1fcc 100644
--- a/core/helpers/access.php
+++ b/core/helpers/access.php
@@ -107,6 +107,19 @@ class access_Core {
}
/**
+ * If the active user does not have this permission, failed with an access::forbidden().
+ *
+ * @param string $perm_name
+ * @param Item_Model $item
+ * @return boolean
+ */
+ public static function required($perm_name, $item) {
+ if (!access::can($perm_name, $item)) {
+ access::forbidden();
+ }
+ }
+
+ /**
* Terminate immediately with an HTTP 503 Forbidden response.
*/
public static function forbidden() {