summaryrefslogtreecommitdiffstats
path: root/apps/oauth2/lib/Db/AccessTokenMapper.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/oauth2/lib/Db/AccessTokenMapper.php')
-rw-r--r--apps/oauth2/lib/Db/AccessTokenMapper.php14
1 files changed, 14 insertions, 0 deletions
diff --git a/apps/oauth2/lib/Db/AccessTokenMapper.php b/apps/oauth2/lib/Db/AccessTokenMapper.php
index 2751302522c..51b97bf8d7a 100644
--- a/apps/oauth2/lib/Db/AccessTokenMapper.php
+++ b/apps/oauth2/lib/Db/AccessTokenMapper.php
@@ -22,6 +22,7 @@
namespace OCA\OAuth2\Db;
use OCP\AppFramework\Db\Mapper;
+use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\IDBConnection;
class AccessTokenMapper extends Mapper {
@@ -48,4 +49,17 @@ class AccessTokenMapper extends Mapper {
$result->closeCursor();
return AccessToken::fromRow($row);
}
+
+ /**
+ * delete all access token from a given client
+ *
+ * @param int $id
+ */
+ public function deleteByClientId($id) {
+ $qb = $this->db->getQueryBuilder();
+ $qb
+ ->delete($this->tableName)
+ ->where($qb->expr()->eq('client_id', $qb->createNamedParameter($id, IQueryBuilder::PARAM_INT)));
+ $qb->execute();
+ }
}