From 1afccde16a04f9a91f9c5c46090517a54670f34d Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Wed, 3 Aug 2016 15:57:06 +0200 Subject: allow configuring filesystem access Signed-off-by: Robin Appelman --- .../Authentication/Token/DefaultTokenMapper.php | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'lib/private/Authentication/Token/DefaultTokenMapper.php') 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 @@ -87,6 +87,30 @@ class DefaultTokenMapper extends Mapper { return DefaultToken::fromRow($data); } + /** + * 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 * -- cgit v1.2.3