blob: f5721c837520b94176ec1ec2926ef3292bfee5a3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
<?php
/**
* Nextcloud - News
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Alessandro Cosentino <cosenal@gmail.com>
* @author Bernhard Posselt <dev@bernhard-posselt.com>
* @author David Guillot <david@guillot.me>
* @copyright 2012 Alessandro Cosentino
* @copyright 2012-2014 Bernhard Posselt
* @copyright 2018 David Guillot
*/
namespace OCA\News\Controller;
use \OCP\IRequest;
use \OCP\IUserSession;
class UserApiController extends ApiController
{
public function __construct(
IRequest $request,
?IUserSession $userSession
) {
parent::__construct($request, $userSession);
}
/**
* @NoAdminRequired
* @NoCSRFRequired
* @CORS
*
* @deprecated Should use https://docs.nextcloud.com/server/latest/developer_manual/client_apis/OCS/ocs-api-overview.html#user-metadata
* and avatar is `https://nc.url/avatar/{userid}/{size}?v={1|2}`
*/
public function index(): array
{
$user = $this->getUser();
$avatar = null;
return [
'userId' => $user->getUID(),
'displayName' => $user->getDisplayName(),
'lastLoginTimestamp' => $user->getLastLogin(),
'avatar' => $avatar
];
}
}
|