summaryrefslogtreecommitdiffstats
path: root/application/controllers/api/v1/user.php
diff options
context:
space:
mode:
Diffstat (limited to 'application/controllers/api/v1/user.php')
-rw-r--r--application/controllers/api/v1/user.php39
1 files changed, 39 insertions, 0 deletions
diff --git a/application/controllers/api/v1/user.php b/application/controllers/api/v1/user.php
new file mode 100644
index 000000000..e49b7c657
--- /dev/null
+++ b/application/controllers/api/v1/user.php
@@ -0,0 +1,39 @@
+<?php
+/*
+ * Copyright 2014 Florian "Bluewind" Pritz <bluewind@server-speed.net>
+ *
+ * Licensed under AGPLv3
+ * (see COPYING for full license text)
+ *
+ */
+namespace controllers\api\v1;
+
+class user extends \controllers\api\api_controller {
+ public function __construct()
+ {
+ parent::__construct();
+
+ $this->load->model('muser');
+ }
+
+ public function apikeys()
+ {
+ $this->muser->require_access("full");
+ return \service\user::apikeys($this->muser->get_userid());
+ }
+
+ public function create_apikey()
+ {
+ $this->muser->require_access("full");
+ $userid = $this->muser->get_userid();
+ $comment = $this->input->post("comment");
+ $comment = $comment === false ? "" : $comment;
+ $access_level = $this->input->post("access_level");
+
+ $key = \service\user::create_apikey($userid, $comment, $access_level);
+
+ return array(
+ "new_key" => $key,
+ );
+ }
+}