summaryrefslogtreecommitdiff
path: root/modules/rest/helpers/rest.php
diff options
context:
space:
mode:
Diffstat (limited to 'modules/rest/helpers/rest.php')
-rw-r--r--modules/rest/helpers/rest.php9
1 files changed, 5 insertions, 4 deletions
diff --git a/modules/rest/helpers/rest.php b/modules/rest/helpers/rest.php
index b382cb29..bcb12d58 100644
--- a/modules/rest/helpers/rest.php
+++ b/modules/rest/helpers/rest.php
@@ -66,17 +66,18 @@ 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()) {
- $key->user_id = $user_id;
+ $key->user_id = identity::active_user()->id;
$key->access_key = md5(md5(uniqid(mt_rand(), true) . access::private_key()));
$key->save();
}
- return $key;
+
+ return $key->access_key;
}
/**