Fixes + ApiKeys

This commit is contained in:
2020-02-10 12:16:34 +01:00
parent 1853756db4
commit 6f8b3f93e9
13 changed files with 354 additions and 4 deletions

View File

@@ -0,0 +1,33 @@
<?php
namespace Api;
class GetApiKeys extends Request {
public function __construct($user, $externCall = false) {
parent::__construct($user, $externCall, array());
$this->loginRequired = true;
}
public function execute($values = array()) {
if(!parent::execute($values)) {
return false;
}
$query = "SELECT ApiKey.uid, ApiKey.api_key, ApiKey.valid_until
FROM ApiKey
WHERE ApiKey.uidUser = ?
AND ApiKey.valid_until > now()";
$request = new ExecuteSelect($this->user);
$this->success = $request->execute(array("query" => $query, $this->user->getId()));
$this->lastError = $request->getLastError();
if($this->success) {
$this->result["api_keys"] = $request->getResult()['rows'];
}
return $this->success;
}
};
?>