summaryrefslogtreecommitdiff
path: root/modules/rest/helpers
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2010-06-18 20:43:14 -0700
committerBharat Mediratta <bharat@menalto.com>2010-06-18 20:43:14 -0700
commit9b788674275c843947d44934a50dd395b515737a (patch)
tree28cf8c7e81935a3dfc311a5e1bdc916fa3471943 /modules/rest/helpers
parent295a42e0f1d5bf5ba1a6a11fe7e222da59dae40b (diff)
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.
Diffstat (limited to 'modules/rest/helpers')
-rw-r--r--modules/rest/helpers/rest.php7
1 files changed, 4 insertions, 3 deletions
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;
}
/**