Rename table back to lowercase
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
This commit is contained in:
parent
26ee889fec
commit
77827ebf11
2 changed files with 18 additions and 14 deletions
|
@ -31,7 +31,7 @@ use OCP\IUser;
|
|||
class DefaultTokenMapper extends Mapper {
|
||||
|
||||
public function __construct(IDBConnection $db) {
|
||||
parent::__construct($db, 'AuthToken');
|
||||
parent::__construct($db, 'authtoken');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -42,7 +42,7 @@ class DefaultTokenMapper extends Mapper {
|
|||
public function invalidate($token) {
|
||||
/* @var $qb IQueryBuilder */
|
||||
$qb = $this->db->getQueryBuilder();
|
||||
$qb->delete('AuthToken')
|
||||
$qb->delete('authtoken')
|
||||
->where($qb->expr()->eq('token', $qb->createParameter('token')))
|
||||
->setParameter('token', $token)
|
||||
->execute();
|
||||
|
@ -55,7 +55,7 @@ class DefaultTokenMapper extends Mapper {
|
|||
public function invalidateOld($olderThan, $remember = IToken::DO_NOT_REMEMBER) {
|
||||
/* @var $qb IQueryBuilder */
|
||||
$qb = $this->db->getQueryBuilder();
|
||||
$qb->delete('AuthToken')
|
||||
$qb->delete('authtoken')
|
||||
->where($qb->expr()->lt('last_activity', $qb->createNamedParameter($olderThan, IQueryBuilder::PARAM_INT)))
|
||||
->andWhere($qb->expr()->eq('type', $qb->createNamedParameter(IToken::TEMPORARY_TOKEN, IQueryBuilder::PARAM_INT)))
|
||||
->andWhere($qb->expr()->eq('remember', $qb->createNamedParameter($remember, IQueryBuilder::PARAM_INT)))
|
||||
|
@ -73,7 +73,7 @@ class DefaultTokenMapper extends Mapper {
|
|||
/* @var $qb IQueryBuilder */
|
||||
$qb = $this->db->getQueryBuilder();
|
||||
$result = $qb->select('id', 'uid', 'login_name', 'password', 'name', 'type', 'remember', 'token', 'last_activity', 'last_check', 'scope')
|
||||
->from('AuthToken')
|
||||
->from('authtoken')
|
||||
->where($qb->expr()->eq('token', $qb->createNamedParameter($token)))
|
||||
->execute();
|
||||
|
||||
|
@ -97,7 +97,7 @@ class DefaultTokenMapper extends Mapper {
|
|||
/* @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')
|
||||
->from('authtoken')
|
||||
->where($qb->expr()->eq('id', $qb->createNamedParameter($id)))
|
||||
->execute();
|
||||
|
||||
|
@ -122,7 +122,7 @@ class DefaultTokenMapper extends Mapper {
|
|||
/* @var $qb IQueryBuilder */
|
||||
$qb = $this->db->getQueryBuilder();
|
||||
$qb->select('id', 'uid', 'login_name', 'password', 'name', 'type', 'remember', 'token', 'last_activity', 'last_check', 'scope')
|
||||
->from('AuthToken')
|
||||
->from('authtoken')
|
||||
->where($qb->expr()->eq('uid', $qb->createNamedParameter($user->getUID())))
|
||||
->setMaxResults(1000);
|
||||
$result = $qb->execute();
|
||||
|
@ -143,7 +143,7 @@ class DefaultTokenMapper extends Mapper {
|
|||
public function deleteById(IUser $user, $id) {
|
||||
/* @var $qb IQueryBuilder */
|
||||
$qb = $this->db->getQueryBuilder();
|
||||
$qb->delete('AuthToken')
|
||||
$qb->delete('authtoken')
|
||||
->where($qb->expr()->eq('id', $qb->createNamedParameter($id)))
|
||||
->andWhere($qb->expr()->eq('uid', $qb->createNamedParameter($user->getUID())));
|
||||
$qb->execute();
|
||||
|
@ -156,7 +156,7 @@ class DefaultTokenMapper extends Mapper {
|
|||
*/
|
||||
public function deleteByName($name) {
|
||||
$qb = $this->db->getQueryBuilder();
|
||||
$qb->delete('AuthToken')
|
||||
$qb->delete('authtoken')
|
||||
->where($qb->expr()->eq('name', $qb->createNamedParameter($name)));
|
||||
$qb->execute();
|
||||
}
|
||||
|
|
|
@ -58,8 +58,8 @@ class DefaultTokenMapperTest extends TestCase {
|
|||
|
||||
private function resetDatabase() {
|
||||
$qb = $this->dbConnection->getQueryBuilder();
|
||||
$qb->delete('AuthToken')->execute();
|
||||
$qb->insert('AuthToken')->values([
|
||||
$qb->delete('authtoken')->execute();
|
||||
$qb->insert('authtoken')->values([
|
||||
'uid' => $qb->createNamedParameter('user1'),
|
||||
'login_name' => $qb->createNamedParameter('User1'),
|
||||
'password' => $qb->createNamedParameter('a75c7116460c082912d8f6860a850904|3nz5qbG1nNSLLi6V|c55365a0e54cfdfac4a175bcf11a7612aea74492277bba6e5d96a24497fa9272488787cb2f3ad34d8b9b8060934fce02f008d371df3ff3848f4aa61944851ff0'),
|
||||
|
@ -69,7 +69,7 @@ class DefaultTokenMapperTest extends TestCase {
|
|||
'last_activity' => $qb->createNamedParameter($this->time - 120, IQueryBuilder::PARAM_INT), // Two minutes ago
|
||||
'last_check' => $this->time - 60 * 10, // 10mins ago
|
||||
])->execute();
|
||||
$qb->insert('AuthToken')->values([
|
||||
$qb->insert('authtoken')->values([
|
||||
'uid' => $qb->createNamedParameter('user2'),
|
||||
'login_name' => $qb->createNamedParameter('User2'),
|
||||
'password' => $qb->createNamedParameter('971a337057853344700bbeccf836519f|UwOQwyb34sJHtqPV|036d4890f8c21d17bbc7b88072d8ef049a5c832a38e97f3e3d5f9186e896c2593aee16883f617322fa242728d0236ff32d163caeb4bd45e14ca002c57a88665f'),
|
||||
|
@ -79,7 +79,7 @@ class DefaultTokenMapperTest extends TestCase {
|
|||
'last_activity' => $qb->createNamedParameter($this->time - 60 * 60 * 24 * 3, IQueryBuilder::PARAM_INT), // Three days ago
|
||||
'last_check' => $this->time - 10, // 10secs ago
|
||||
])->execute();
|
||||
$qb->insert('AuthToken')->values([
|
||||
$qb->insert('authtoken')->values([
|
||||
'uid' => $qb->createNamedParameter('user1'),
|
||||
'login_name' => $qb->createNamedParameter('User1'),
|
||||
'password' => $qb->createNamedParameter('063de945d6f6b26862d9b6f40652f2d5|DZ/z520tfdXPtd0T|395f6b89be8d9d605e409e20b9d9abe477fde1be38a3223f9e508f979bf906e50d9eaa4dca983ca4fb22a241eb696c3f98654e7775f78c4caf13108f98642b53'),
|
||||
|
@ -94,7 +94,7 @@ class DefaultTokenMapperTest extends TestCase {
|
|||
private function getNumberOfTokens() {
|
||||
$qb = $this->dbConnection->getQueryBuilder();
|
||||
$result = $qb->select($qb->createFunction('count(*) as `count`'))
|
||||
->from('AuthToken')
|
||||
->from('authtoken')
|
||||
->execute()
|
||||
->fetch();
|
||||
return (int) $result['count'];
|
||||
|
@ -190,6 +190,7 @@ class DefaultTokenMapperTest extends TestCase {
|
|||
}
|
||||
|
||||
public function testGetTokenByUser() {
|
||||
/** @var IUser|\PHPUnit_Framework_MockObject_MockObject $user */
|
||||
$user = $this->createMock(IUser::class);
|
||||
$user->expects($this->once())
|
||||
->method('getUID')
|
||||
|
@ -199,6 +200,7 @@ class DefaultTokenMapperTest extends TestCase {
|
|||
}
|
||||
|
||||
public function testGetTokenByUserNotFound() {
|
||||
/** @var IUser|\PHPUnit_Framework_MockObject_MockObject $user */
|
||||
$user = $this->createMock(IUser::class);
|
||||
$user->expects($this->once())
|
||||
->method('getUID')
|
||||
|
@ -208,10 +210,11 @@ class DefaultTokenMapperTest extends TestCase {
|
|||
}
|
||||
|
||||
public function testDeleteById() {
|
||||
/** @var IUser|\PHPUnit_Framework_MockObject_MockObject $user */
|
||||
$user = $this->createMock(IUser::class);
|
||||
$qb = $this->dbConnection->getQueryBuilder();
|
||||
$qb->select('id')
|
||||
->from('AuthToken')
|
||||
->from('authtoken')
|
||||
->where($qb->expr()->eq('token', $qb->createNamedParameter('9c5a2e661482b65597408a6bb6c4a3d1af36337381872ac56e445a06cdb7fea2b1039db707545c11027a4966919918b19d875a8b774840b18c6cbb7ae56fe206')));
|
||||
$result = $qb->execute();
|
||||
$id = $result->fetch()['id'];
|
||||
|
@ -224,6 +227,7 @@ class DefaultTokenMapperTest extends TestCase {
|
|||
}
|
||||
|
||||
public function testDeleteByIdWrongUser() {
|
||||
/** @var IUser|\PHPUnit_Framework_MockObject_MockObject $user */
|
||||
$user = $this->createMock(IUser::class);
|
||||
$id = 33;
|
||||
$user->expects($this->once())
|
||||
|
|
Loading…
Reference in a new issue