mirror of
https://github.com/elyby/oauth2-server.git
synced 2024-11-15 17:56:14 +05:30
Fix bad accesses and bad arguments.
This commit is contained in:
parent
8cfa3dcdad
commit
3b17872f10
@ -59,11 +59,11 @@ $router->get('/users', function (Request $request) use ($server) {
|
|||||||
'name' => $result['name'],
|
'name' => $result['name'],
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($server->hasScope('email')) {
|
if ($server->getAccessToken()->hasScope('email')) {
|
||||||
$user['email'] = $result['email'];
|
$user['email'] = $result['email'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($server->hasScope('photo')) {
|
if ($server->getAccessToken()->hasScope('photo')) {
|
||||||
$user['photo'] = $result['photo'];
|
$user['photo'] = $result['photo'];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,7 +74,7 @@ $router->get('/users', function (Request $request) use ($server) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// GET /users/{username}
|
// GET /users/{username}
|
||||||
$router->get('/users/{username}', function (Request $request, $args) use ($server) {
|
$router->get('/users/{username}', function (Request $request, Response $response, array $args) use ($server) {
|
||||||
|
|
||||||
$result = (new Model\Users())->get($args['username']);
|
$result = (new Model\Users())->get($args['username']);
|
||||||
|
|
||||||
@ -87,11 +87,11 @@ $router->get('/users/{username}', function (Request $request, $args) use ($serve
|
|||||||
'name' => $result[0]['name'],
|
'name' => $result[0]['name'],
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($server->hasScope('email')) {
|
if ($server->getAccessToken()->hasScope('email')) {
|
||||||
$user['email'] = $result[0]['email'];
|
$user['email'] = $result[0]['email'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($server->hasScope('photo')) {
|
if ($server->getAccessToken()->hasScope('photo')) {
|
||||||
$user['photo'] = $result[0]['photo'];
|
$user['photo'] = $result[0]['photo'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user