forked from dragonling/phalcon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
UsersController.php
51 lines (47 loc) · 1.15 KB
/
UsersController.php
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
51
<?php
namespace WscnApiVer2\Controllers;
use Swagger\Annotations as SWG;
use Eva\EvaEngine\Exception;
use Eva\EvaUser\Forms\LoginForm;
use Eva\EvaUser\Models\Login;
use Eva\EvaUser\Models\User;
use Eva\EvaPermission\Models\Apikey;
use Eva\EvaEngine\Mvc\Controller\TokenAuthorityControllerInterface;
/**
* @package
* @category
* @subpackage
*
* @SWG\Resource(
* apiVersion="0.2",
* swaggerVersion="1.2",
* resourcePath="/Users",
* basePath="/v2"
* )
* @resourceName("用户API")
* @resourceDescription("用户API")
*/
class UsersController extends ControllerBase implements TokenAuthorityControllerInterface
{
/**
*
* @SWG\Api(
* path="/users/me",
* description="User API",
* produces="['application/json']",
* @SWG\Operations(
* @SWG\Operation(
* method="GET",
* summary="Get current user info",
* )
* )
* )
*/
public function indexAction()
{
Login::setLoginMode(Login::LOGIN_MODE_TOKEN);
$storage = Login::getAuthStorage();
$userinfo = Login::getCurrentUser();
return $this->response->setJsonContent($userinfo);
}
}