summaryrefslogtreecommitdiff
path: root/services/userservice.php
diff options
context:
space:
mode:
authorcweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f>2009-09-22 06:12:25 +0000
committercweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f>2009-09-22 06:12:25 +0000
commit724d9fa421dad542a9ea74f14cd8b43ec44e22d3 (patch)
tree3cb1ea7ce0aac5f4e0c99a884c7de63984721ceb /services/userservice.php
parentf05dad73e062f5efbc5579f0ac60df8a8e8ff970 (diff)
downloadsemanticscuttle-724d9fa421dad542a9ea74f14cd8b43ec44e22d3.tar.gz
semanticscuttle-724d9fa421dad542a9ea74f14cd8b43ec44e22d3.tar.bz2
Fix bug #2674961: editAllowed optimization - make less queries for each bookmark
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@366 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'services/userservice.php')
-rw-r--r--services/userservice.php21
1 files changed, 17 insertions, 4 deletions
diff --git a/services/userservice.php b/services/userservice.php
index 512204c..a24c7ba 100644
--- a/services/userservice.php
+++ b/services/userservice.php
@@ -213,11 +213,24 @@ class UserService {
}
}
- function isAdmin($userid) {
- $user = $this->getUser($userid);
+ /**
+ * Checks if the given user is an administrator.
+ * Uses global admin_users property containing admin
+ * user names
+ *
+ * @param integer|array $user User ID or user row from DB
+ *
+ * @return boolean True if the user is admin
+ */
+ function isAdmin($user)
+ {
+ if (is_numeric($user)) {
+ $user = $this->getUser($user);
+ }
- if(isset($GLOBALS['admin_users'])
- && in_array($user['username'], $GLOBALS['admin_users'])) {
+ if (isset($GLOBALS['admin_users'])
+ && in_array($user['username'], $GLOBALS['admin_users'])
+ ) {
return true;
} else {
return false;