Skip to content

fix #4274 【システム】管理画面URLを変更している場合、ユーザーグループのアクセスルールが正しく機能しない#4395

Open
kaburk wants to merge 1 commit into
baserproject:5.2.xfrom
kaburk:5.2.x-#4274
Open

fix #4274 【システム】管理画面URLを変更している場合、ユーザーグループのアクセスルールが正しく機能しない#4395
kaburk wants to merge 1 commit into
baserproject:5.2.xfrom
kaburk:5.2.x-#4274

Conversation

@kaburk
Copy link
Copy Markdown
Collaborator

@kaburk kaburk commented May 22, 2026

よろしくお願いします。

Copilot AI review requested due to automatic review settings May 22, 2026 10:49
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

管理画面URL(.envADMIN_PREFIX / BASER_CORE_PREFIX)を変更している環境で、ユーザーグループのアクセスルール(Permissions)が正しくマッチするようにすることを目的としたPRです。権限URLがDB上では標準プレフィックス(/baser/admin 等)で保存されている前提を、実際のプレフィックスへ変換して照合する方向に寄せています。

Changes:

  • URL照合時のプレフィックス変換ロジックを checkGroup() 側から convertRegexUrl() 側へ移動
  • DB保存の標準プレフィックス(/baser/admin, /baser/api/admin)→ 実プレフィックスへの変換処理を追加
  • 変換仕様を検証するユニットテストを追加

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
plugins/baser-core/src/Service/PermissionsService.php 権限URLの正規表現化処理で、標準プレフィックスを実プレフィックスへ変換するよう変更
plugins/baser-core/tests/TestCase/Service/PermissionsServiceTest.php 標準プレフィックス→実プレフィックス変換のテストケースを追加

Comment on lines +549 to +563
$baserCorePrefix = BcUtil::getBaserCorePrefix();
$adminPrefix = BcUtil::getAdminPrefix();
$apiPrefix = Configure::read('BcApp.apiPrefix');
// DB に保存された標準プレフィックス(/baser/api/admin, /baser/admin)を
// .env の設定値に基づく実際のプレフィックスに変換する
$url = preg_replace(
[
'/^\/baser\/' . preg_quote($apiPrefix, '/') . '\/admin/',
'/^\/baser\/admin/',
],
[
'/' . $baserCorePrefix . '/' . $apiPrefix . '/' . $adminPrefix,
'/' . $baserCorePrefix . '/' . $adminPrefix,
],
$url
$this->assertEquals($expected, $result);

$url = '/baser/api/admin/baser-core/contents/index.json';
$expected = '/^\/' . preg_quote($baserCorePrefix . '/' . $apiPrefix . '/' . $adminPrefix . '/baser-core/contents/index.json', '/') . '$/is';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants