aboutsummaryrefslogtreecommitdiff
path: root/engine
diff options
context:
space:
mode:
Diffstat (limited to 'engine')
-rw-r--r--engine/lib/admin.php24
-rw-r--r--engine/lib/entities.php2
2 files changed, 23 insertions, 3 deletions
diff --git a/engine/lib/admin.php b/engine/lib/admin.php
index e9b3e6684..aa730407c 100644
--- a/engine/lib/admin.php
+++ b/engine/lib/admin.php
@@ -50,7 +50,27 @@
// Register some actions
register_action('admin/site/update_basic', false, "", true); // Register basic site admin action
}
-
+
+ /**
+ * Admin permissions system
+ *
+ * @return true|null True if the current user is an admin.
+ */
+ function admin_permissions($hook, $type, $returnval, $params) {
+
+ if (is_array($params) && !empty($params['user']) && $params['user'] instanceof ElggUser) {
+ $admin = $params['user']->admin;
+ if ($admin) {
+ return true;
+ }
+ }
+
+ }
+
/// Register init function
- register_elgg_event_handler('init','system','admin_init');
+ register_elgg_event_handler('init','system','admin_init');
+
+ // Register a plugin hook for permissions
+ register_plugin_hook('permissions_check','all','admin_permissions');
+
?> \ No newline at end of file
diff --git a/engine/lib/entities.php b/engine/lib/entities.php
index 2474c44be..7735b651b 100644
--- a/engine/lib/entities.php
+++ b/engine/lib/entities.php
@@ -1243,7 +1243,7 @@
if ($entity->getOwner() == $user->getGUID()) return true;
if ($entity->type == "user" && $entity->getGUID() == $user->getGUID()) return true;
- return trigger_plugin_hook('permissions_check',$entity->type,array('entity' => $entity, 'user' => $user),true);
+ return trigger_plugin_hook('permissions_check',$entity->type,array('entity' => $entity, 'user' => $user),false);
} else {
return false;