Skip to content
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.

Commit

Permalink
【BcFavorite】よく使う項目に登録しようとするとローディングが表示され続ける fix #2127 #2114 #2113
Browse files Browse the repository at this point in the history
  • Loading branch information
ryuring committed Mar 19, 2023
1 parent 7a1bbfb commit 2c0dc5d
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
18 changes: 9 additions & 9 deletions plugins/baser-core/src/Controller/Api/BcApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace BaserCore\Controller\Api;

use Authentication\Authenticator\AuthenticationRequiredException;
use Authentication\Authenticator\JwtAuthenticator;
use Authentication\Authenticator\ResultInterface;
use Authentication\Controller\Component\AuthenticationComponent;
Expand All @@ -21,8 +22,10 @@
use BaserCore\Error\BcException;
use BaserCore\Utility\BcApiUtil;
use BaserCore\Utility\BcContainerTrait;
use Cake\Controller\Exception\AuthSecurityException;
use Cake\Core\Configure;
use Cake\Event\EventInterface;
use Cake\Http\Exception\ForbiddenException;
use Cake\ORM\TableRegistry;

/**
Expand Down Expand Up @@ -84,14 +87,13 @@ public function beforeFilter(EventInterface $event)
return;
}

if (!filter_var(env('USE_CORE_ADMIN_API', false), FILTER_VALIDATE_BOOLEAN)) {
$this->setResponse($this->response->withStatus(401));
if (!$this->isAdminApiEnabled()) {
return $this->response->withStatus(401);
}

// ユーザーの有効チェック
if (!$this->isAvailableUser()) {
$this->setResponse($this->response->withStatus(401));
return;
return $this->response->withStatus(401);
}

// トークンタイプチェック
Expand All @@ -107,14 +109,12 @@ public function beforeFilter(EventInterface $event)
/**
* 認証が必要なAPIを利用可能かどうか判定
*
* @return \Authentication\IdentityInterface|false|null
* @return bool
*/
public function isAdminApiEnabled()
{
if (!filter_var(env('USE_CORE_ADMIN_API', false), FILTER_VALIDATE_BOOLEAN)) {
return false;
}
return (bool) $this->Authentication->getIdentity();
if($this->Authentication->getIdentity()) return true;
return (filter_var(env('USE_CORE_ADMIN_API', false), FILTER_VALIDATE_BOOLEAN));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion plugins/baser-core/src/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ public function getAuthenticationService(ServerRequestInterface $request): Authe

if (!$this->isRequiredAuthentication($authSetting)) {
$service->loadAuthenticator('Authentication.Form');
if (!empty($authSetting['sessionKey']) && empty($authSetting['disabled'])) {
if (!empty($authSetting['sessionKey'])) {
$service->loadAuthenticator('Authentication.Session', [
'sessionKey' => $authSetting['sessionKey'],
]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ export default {
// ボタンの制御
this.favoriteBoxOpened = 'block';
this.ariaExpanded = 'false';
axios.post(baseUrl + '1.json', {}, {
axios.post(baseUrl + '/1.json', {}, {
headers: {
"Authorization": $.bcJwt.accessToken,
}
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

0 comments on commit 2c0dc5d

Please sign in to comment.