summaryrefslogtreecommitdiffstats
path: root/apps/oauth2/lib/Db/ClientMapper.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/oauth2/lib/Db/ClientMapper.php')
-rw-r--r--apps/oauth2/lib/Db/ClientMapper.php22
1 files changed, 22 insertions, 0 deletions
diff --git a/apps/oauth2/lib/Db/ClientMapper.php b/apps/oauth2/lib/Db/ClientMapper.php
index 38751a2e5cf..cf00afacb70 100644
--- a/apps/oauth2/lib/Db/ClientMapper.php
+++ b/apps/oauth2/lib/Db/ClientMapper.php
@@ -22,6 +22,7 @@
namespace OCA\OAuth2\Db;
use OCP\AppFramework\Db\Mapper;
+use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\IDBConnection;
class ClientMapper extends Mapper {
@@ -55,6 +56,27 @@ class ClientMapper extends Mapper {
}
/**
+ * @param string $uid internal uid of the client
+ * @return Client
+ */
+ public function getByUid($uid) {
+ $qb = $this->db->getQueryBuilder();
+ $qb
+ ->select('*')
+ ->from($this->tableName)
+ ->where($qb->expr()->eq('id', $qb->createNamedParameter($uid, IQueryBuilder::PARAM_INT)));
+ $result = $qb->execute();
+ $row = $result->fetch();
+ $result->closeCursor();
+
+ if (!is_array($row)) {
+ $row = [];
+ }
+
+ return Client::fromRow($row);
+ }
+
+ /**
* @return Client[]
*/
public function getClients() {