aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Authentication/Token/DefaultTokenMapper.php
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2016-08-03 15:57:06 +0200
committerRobin Appelman <robin@icewind.nl>2016-11-16 15:24:27 +0100
commit1afccde16a04f9a91f9c5c46090517a54670f34d (patch)
tree400495cbb0f40c7054b5fc63539d3546aac1975b /lib/private/Authentication/Token/DefaultTokenMapper.php
parentb4e27d35f59e359eb7591a15c7f037968081eb1b (diff)
downloadnextcloud-server-1afccde16a04f9a91f9c5c46090517a54670f34d.tar.gz
nextcloud-server-1afccde16a04f9a91f9c5c46090517a54670f34d.zip
allow configuring filesystem access
Signed-off-by: Robin Appelman <icewind@owncloud.com>
Diffstat (limited to 'lib/private/Authentication/Token/DefaultTokenMapper.php')
-rw-r--r--lib/private/Authentication/Token/DefaultTokenMapper.php24
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/private/Authentication/Token/DefaultTokenMapper.php b/lib/private/Authentication/Token/DefaultTokenMapper.php
index bfcb54c66c0..32551a9b37c 100644
--- a/lib/private/Authentication/Token/DefaultTokenMapper.php
+++ b/lib/private/Authentication/Token/DefaultTokenMapper.php
@@ -88,6 +88,30 @@ class DefaultTokenMapper extends Mapper {
}
/**
+ * Get the user UID for the given token
+ *
+ * @param string $token
+ * @throws DoesNotExistException
+ * @return DefaultToken
+ */
+ public function getTokenById($token) {
+ /* @var $qb IQueryBuilder */
+ $qb = $this->db->getQueryBuilder();
+ $result = $qb->select('id', 'uid', 'login_name', 'password', 'name', 'type', 'token', 'last_activity', 'last_check', 'scope')
+ ->from('authtoken')
+ ->where($qb->expr()->eq('id', $qb->createParameter('id')))
+ ->setParameter('id', $token)
+ ->execute();
+
+ $data = $result->fetch();
+ $result->closeCursor();
+ if ($data === false) {
+ throw new DoesNotExistException('token does not exist');
+ };
+ return DefaultToken::fromRow($data);
+ }
+
+ /**
* Get all token of a user
*
* The provider may limit the number of result rows in case of an abuse