aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/access.php
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-09-10 22:25:48 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-09-10 22:25:48 +0000
commitaf59be06054d862444024d0261866df95ce89964 (patch)
treed099a9eb6326a584c86d0b56626d4ebd42c52e48 /engine/lib/access.php
parent1e41f151ff3a48eeac21e2b83d9c4c4dd447b839 (diff)
downloadelgg-af59be06054d862444024d0261866df95ce89964.tar.gz
elgg-af59be06054d862444024d0261866df95ce89964.tar.bz2
Updated fixes for checking for admin in get_access_sql_prefix()
git-svn-id: https://code.elgg.org/elgg/trunk@3485 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/access.php')
-rw-r--r--engine/lib/access.php19
1 files changed, 13 insertions, 6 deletions
diff --git a/engine/lib/access.php b/engine/lib/access.php
index 5ccf238c8..7edb2d012 100644
--- a/engine/lib/access.php
+++ b/engine/lib/access.php
@@ -225,14 +225,21 @@ END;
if (!isset($owner)) {
$owner = get_loggedin_userid();
}
- if (!$owner) $owner = -1;
- $access = get_access_list($owner);
-
- // do NOT use $is_admin global user here, since that only checks against
+ // do NOT use $is_admin global here, since that only checks against
// the current logged in user.
+ // Can't use metadata here because because of recursion.
+ // (get_entity, get_*() calls this function.)
+ if (!$owner) {
+ $owner = -1;
+ $admin = false;
+ } else {
+ $admin = is_admin_user($owner);
+ }
+
+ $access = get_access_list($owner);
- if ($owner->admin == 'yes') {
+ if ($admin) {
$sql = " (1 = 1) ";
} else if ($owner != -1) {
$friends_bit = $table_prefix.'access_id = '.ACCESS_FRIENDS.' AND ';
@@ -729,4 +736,4 @@ END;
// This function will let us know when 'init' has finished
register_elgg_event_handler('init','system','access_init',9999);
-?> \ No newline at end of file
+?>