diff options
author | Tim Almdal <tnalmdal@shaw.ca> | 2010-09-12 10:57:41 -0700 |
---|---|---|
committer | Tim Almdal <tnalmdal@shaw.ca> | 2010-09-12 10:57:41 -0700 |
commit | bd532f6c88ef54bd47c9b1af46bc8d2c80d4407b (patch) | |
tree | 7522d38320d6466ac400a97ace5ba3b2d37048fd /modules/user/helpers | |
parent | ac64614d4da7174c085f257f3b8e39aa7afa9eb5 (diff) | |
parent | f84c4a6192ea0e47ca5b2006baa0bfd7e09a682c (diff) |
Merge branch 'master' of git@github.com:gallery/gallery3
Diffstat (limited to 'modules/user/helpers')
-rw-r--r-- | modules/user/helpers/user.php | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/modules/user/helpers/user.php b/modules/user/helpers/user.php index 55153263..be50d6d1 100644 --- a/modules/user/helpers/user.php +++ b/modules/user/helpers/user.php @@ -36,6 +36,20 @@ class user_Core { } /** + * Return an admin user. Prefer the currently logged in user, if possible. + * + * @return User_Model + */ + static function admin_user() { + $active = identity::active_user(); + if ($active->admin) { + return $active; + } + + return ORM::factory("user")->where("admin", "=", 1)->order_by("id", "ASC")->find(); + } + + /** * Is the password provided correct? * * @param user User Model |