diff options
| author | Christian Weiske <cweiske@cweiske.de> | 2014-08-22 17:17:01 +0200 |
|---|---|---|
| committer | Christian Weiske <cweiske@cweiske.de> | 2014-08-22 17:17:01 +0200 |
| commit | f7ecfa21088175bc236b1136c1a4b2aa2488f37c (patch) | |
| tree | 2cdc3b15ef8d8e6fed4f9692464d3d0811eced6c /lib/tokenstorage.php | |
| parent | 92943b3dbac9db26d95500e129bd70475c376b1e (diff) | |
| download | grauphel-f7ecfa21088175bc236b1136c1a4b2aa2488f37c.tar.gz grauphel-f7ecfa21088175bc236b1136c1a4b2aa2488f37c.zip | |
show some statistics on the index page
Diffstat (limited to 'lib/tokenstorage.php')
| -rw-r--r-- | lib/tokenstorage.php | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/tokenstorage.php b/lib/tokenstorage.php index 9a173f5..f8f0806 100644 --- a/lib/tokenstorage.php +++ b/lib/tokenstorage.php @@ -106,6 +106,30 @@ class TokenStorage return $token; } + /** + * Load multiple tokens + * + * @param string $username User name + * @param string $type Token type: temp, access, verify + * + * @return array Array of Token objects + */ + public function loadForUser($username, $type) + { + $result = \OC_DB::executeAudited( + 'SELECT * FROM `*PREFIX*grauphel_oauth_tokens`' + . ' WHERE `token_user` = ? AND `token_type` = ?', + array($username, $type) + ); + + $tokens = array(); + while ($tokenRow = $result->fetchRow()) { + $tokens[] = $this->fromDb($tokenRow); + } + + return $tokens; + } + protected function fromDb($tokenRow) { $token = new Token(); |
