* @author Bernhard Posselt * @author David Guillot * @copyright 2012 Alessandro Cosentino * @copyright 2012-2014 Bernhard Posselt * @copyright 2018 David Guillot */ namespace OCA\News\Controller; use \OCP\IRequest; use \OCP\IUserSession; use \OCP\IURLGenerator; use \OCP\Files\IRootFolder; use \OCP\AppFramework\Http; class UserApiController extends ApiController { public function __construct( string $appName, IRequest $request, IUserSession $userSession ) { parent::__construct($appName, $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 ]; } }