diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2018-05-15 10:56:40 +0200 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2018-05-15 10:56:40 +0200 |
commit | 466297829e978f03421f5e34a4b2c7213332163c (patch) | |
tree | 5bf5725cc2053d525c0adfd25827674465c35db1 /lib | |
parent | 47388e1cfe049265050614f55744adcd77ee8052 (diff) | |
download | nextcloud-server-466297829e978f03421f5e34a4b2c7213332163c.tar.gz nextcloud-server-466297829e978f03421f5e34a4b2c7213332163c.zip |
Fix tests
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'lib')
4 files changed, 29 insertions, 17 deletions
diff --git a/lib/private/Authentication/Token/DefaultToken.php b/lib/private/Authentication/Token/DefaultToken.php index 8ddd9b00cf2..ad4ece0c463 100644 --- a/lib/private/Authentication/Token/DefaultToken.php +++ b/lib/private/Authentication/Token/DefaultToken.php @@ -31,14 +31,12 @@ use OCP\AppFramework\Db\Entity; * @method void setUid(string $uid); * @method void setLoginName(string $loginname) * @method void setPassword(string $password) - * @method string getName() * @method void setName(string $name) * @method void setToken(string $token) * @method string getToken() * @method void setType(int $type) * @method int getType() * @method void setRemember(int $remember) - * @method int getRemember() * @method void setLastActivity(int $lastactivity) * @method int getLastActivity() */ @@ -107,9 +105,9 @@ class DefaultToken extends Entity implements IToken { /** * Get the (encrypted) login password * - * @return string + * @return string|null */ - public function getPassword(): string { + public function getPassword() { return parent::getPassword(); } @@ -136,14 +134,18 @@ class DefaultToken extends Entity implements IToken { * Get the timestamp of the last password check * * @param int $time - * @return int */ - public function setLastCheck(int $time): int { - return parent::setLastCheck($time); + public function setLastCheck(int $time) { + parent::setLastCheck($time); } public function getScope(): string { - return parent::getScope(); + $scope = parent::getScope(); + if ($scope === null) { + return ''; + } + + return $scope; } public function getScopeAsArray(): array { @@ -156,7 +158,17 @@ class DefaultToken extends Entity implements IToken { return $scope; } - public function setScope(array $scope) { - parent::setScope(json_encode($scope)); + public function setScope(array $scope = null) { + if ($scope !== null) { + parent::setScope(json_encode($scope)); + } + } + + public function getName(): string { + return parent::getName(); + } + + public function getRemember(): int { + return parent::getRemember(); } } diff --git a/lib/private/Authentication/Token/DefaultTokenProvider.php b/lib/private/Authentication/Token/DefaultTokenProvider.php index b1d3d227aef..747fb8ef6ea 100644 --- a/lib/private/Authentication/Token/DefaultTokenProvider.php +++ b/lib/private/Authentication/Token/DefaultTokenProvider.php @@ -174,11 +174,11 @@ class DefaultTokenProvider implements IProvider { /** * Get a token by token id * - * @param string $tokenId + * @param int $tokenId * @throws InvalidTokenException * @return IToken */ - public function getTokenById(string $tokenId): IToken { + public function getTokenById(int $tokenId): IToken { try { return $this->mapper->getTokenById($tokenId); } catch (DoesNotExistException $ex) { diff --git a/lib/private/Authentication/Token/IProvider.php b/lib/private/Authentication/Token/IProvider.php index 1928fd32136..9b9048b1635 100644 --- a/lib/private/Authentication/Token/IProvider.php +++ b/lib/private/Authentication/Token/IProvider.php @@ -65,11 +65,11 @@ interface IProvider { /** * Get a token by token id * - * @param string $tokenId + * @param int $tokenId * @throws InvalidTokenException * @return IToken */ - public function getTokenById(string $tokenId): IToken; + public function getTokenById(int $tokenId): IToken; /** * Duplicate an existing session token diff --git a/lib/private/Authentication/Token/IToken.php b/lib/private/Authentication/Token/IToken.php index 07f72d37670..eff525c8d65 100644 --- a/lib/private/Authentication/Token/IToken.php +++ b/lib/private/Authentication/Token/IToken.php @@ -57,9 +57,9 @@ interface IToken extends JsonSerializable { /** * Get the (encrypted) login password * - * @return string + * @return string|null */ - public function getPassword(): string; + public function getPassword(); /** * Get the timestamp of the last password check @@ -94,7 +94,7 @@ interface IToken extends JsonSerializable { * * @param array $scope */ - public function setScope(array $scope); + public function setScope(array $scope = null); public function getName(): string; |