Type some of the core mappers

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
This commit is contained in:
Christoph Wurst 2020-10-09 14:33:17 +02:00
parent a1b351036c
commit 2664c7f75f
No known key found for this signature in database
GPG Key ID: CC42AC2A7F0E56D8
6 changed files with 16 additions and 1 deletions

View File

@ -30,6 +30,9 @@ use OCP\AppFramework\Db\QBMapper;
use OCP\IDBConnection; use OCP\IDBConnection;
use OCP\IUser; use OCP\IUser;
/**
* @template-extends QBMapper<RecentContact>
*/
class RecentContactMapper extends QBMapper { class RecentContactMapper extends QBMapper {
public const TABLE_NAME = 'recent_contact'; public const TABLE_NAME = 'recent_contact';

View File

@ -30,6 +30,9 @@ use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\IDBConnection; use OCP\IDBConnection;
use OCP\IUser; use OCP\IUser;
/**
* @template-extends QBMapper<BackupCode>
*/
class BackupCodeMapper extends QBMapper { class BackupCodeMapper extends QBMapper {
public function __construct(IDBConnection $db) { public function __construct(IDBConnection $db) {
parent::__construct($db, 'twofactor_backupcodes'); parent::__construct($db, 'twofactor_backupcodes');

View File

@ -35,6 +35,9 @@ use OCP\AppFramework\Db\QBMapper;
use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\IDBConnection; use OCP\IDBConnection;
/**
* @template-extends QBMapper<DefaultToken>
*/
class DefaultTokenMapper extends QBMapper { class DefaultTokenMapper extends QBMapper {
public function __construct(IDBConnection $db) { public function __construct(IDBConnection $db) {
parent::__construct($db, 'authtoken'); parent::__construct($db, 'authtoken');

View File

@ -32,6 +32,9 @@ use OCP\AppFramework\Db\QBMapper;
use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\IDBConnection; use OCP\IDBConnection;
/**
* @template-extends QBMapper<PublicKeyToken>
*/
class PublicKeyTokenMapper extends QBMapper { class PublicKeyTokenMapper extends QBMapper {
public function __construct(IDBConnection $db) { public function __construct(IDBConnection $db) {
parent::__construct($db, 'authtoken'); parent::__construct($db, 'authtoken');

View File

@ -219,7 +219,7 @@ class PublicKeyTokenProvider implements IProvider {
$activityInterval = $this->config->getSystemValueInt('token_auth_activity_update', 60); $activityInterval = $this->config->getSystemValueInt('token_auth_activity_update', 60);
$activityInterval = min(max($activityInterval, 0), 300); $activityInterval = min(max($activityInterval, 0), 300);
/** @var DefaultToken $token */ /** @var PublicKeyToken $token */
$now = $this->time->getTime(); $now = $this->time->getTime();
if ($token->getLastActivity() < ($now - $activityInterval)) { if ($token->getLastActivity() < ($now - $activityInterval)) {
// Update token only once per minute // Update token only once per minute

View File

@ -30,6 +30,9 @@ use OCP\AppFramework\Db\DoesNotExistException;
use OCP\AppFramework\Db\QBMapper; use OCP\AppFramework\Db\QBMapper;
use OCP\IDBConnection; use OCP\IDBConnection;
/**
* @template-extends QBMapper<PublicKeyCredentialEntity>
*/
class PublicKeyCredentialMapper extends QBMapper { class PublicKeyCredentialMapper extends QBMapper {
public function __construct(IDBConnection $db) { public function __construct(IDBConnection $db) {
parent::__construct($db, 'webauthn', PublicKeyCredentialEntity::class); parent::__construct($db, 'webauthn', PublicKeyCredentialEntity::class);