diff options
Diffstat (limited to 'lib/private/Authentication/Token/DefaultToken.php')
-rw-r--r-- | lib/private/Authentication/Token/DefaultToken.php | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/private/Authentication/Token/DefaultToken.php b/lib/private/Authentication/Token/DefaultToken.php index 08451a46151..ca4c723fba3 100644 --- a/lib/private/Authentication/Token/DefaultToken.php +++ b/lib/private/Authentication/Token/DefaultToken.php @@ -22,6 +22,7 @@ namespace OC\Authentication\Token; +use JsonSerializable; use OCP\AppFramework\Db\Entity; /** @@ -38,7 +39,7 @@ use OCP\AppFramework\Db\Entity; * @method void setLastActivity(int $lastActivity) * @method int getLastActivity() */ -class DefaultToken extends Entity implements IToken { +class DefaultToken extends Entity implements IToken, JsonSerializable { /** * @var string user UID @@ -87,4 +88,13 @@ class DefaultToken extends Entity implements IToken { return parent::getPassword(); } + public function jsonSerialize() { + return [ + 'id' => $this->id, + 'name' => $this->name, + 'lastActivity' => $this->lastActivity, + 'type' => $this->type, + ]; + } + } |