From 9b788674275c843947d44934a50dd395b515737a Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Fri, 18 Jun 2010 20:43:14 -0700 Subject: Simplify rest::get_access_key($user) to rest::access_key() that returns just the access key string for the active user. That's how we use the API, so keep it simple. --- modules/rest/helpers/rest.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'modules/rest/helpers') diff --git a/modules/rest/helpers/rest.php b/modules/rest/helpers/rest.php index b382cb29..0bad58f6 100644 --- a/modules/rest/helpers/rest.php +++ b/modules/rest/helpers/rest.php @@ -66,9 +66,9 @@ class rest_Core { identity::set_active_user($user); } - static function get_access_key($user_id) { + static function access_key() { $key = ORM::factory("user_access_key") - ->where("user_id", "=", $user_id) + ->where("user_id", "=", identity::active_user()->id) ->find(); if (!$key->loaded()) { @@ -76,7 +76,8 @@ class rest_Core { $key->access_key = md5(md5(uniqid(mt_rand(), true) . access::private_key())); $key->save(); } - return $key; + + return $key->access_key; } /** -- cgit v1.2.3