Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BcUtil::loginUserでプレフィックスを指定しても別のプレフィックスのログイン情報が返却される #1938

Closed
seto1 opened this issue Mar 18, 2023 · 6 comments
Assignees
Labels
Adjusting 調整中 Bug バグ
Milestone

Comments

@seto1
Copy link
Collaborator

seto1 commented Mar 18, 2023

トップページに以下のコードを記載

use BaserCore\Utility\BcUtil;
print_r(BcUtil::loginUser('Test')); // Testは存在しない認証設定

管理画面にログインした状態でトップページにアクセスすると管理画面のログイン情報が表示される

@ryuring ryuring added the Bug バグ label Mar 19, 2023
@ryuring ryuring self-assigned this Mar 19, 2023
@seto1
Copy link
Collaborator Author

seto1 commented Mar 20, 2023

こちらのコミットの内容が
baserproject/ucmitz@7a1bbfb
以下のコミットで戻っているようです。
baserproject/ucmitz@2c0dc5d#diff-31fb8f9f9452d79f4721b47ac02459870b031781cbd9b22c2d3d9d198bb03c2a

また、もとに戻る前の状態でも新たに以下の問題を見つけました。

管理画面のレイアウトに以下のコードを記載して、管理画面にアクセスすると管理画面のログイン情報が表示される

use BaserCore\Utility\BcUtil;
print_r(BcUtil::loginUser('Test')); // Testは存在しない認証設定

@seto1 seto1 reopened this Mar 20, 2023
@ryuring
Copy link
Collaborator

ryuring commented Mar 20, 2023

@seto1 誤コミットでした。失礼しました。こちらのコミットで調整しています。
baserproject/ucmitz@8378dab

管理画面のレイアウトに以下のコードを記載して、管理画面にアクセスすると管理画面のログイン情報が表示される

こちらは対応しようとすると改修範囲が広いので仕様として受け入れる事にしました。
メソッドのヘッダーコメントにその旨明記しました。

@seto1
Copy link
Collaborator Author

seto1 commented Mar 20, 2023

@ryuring 4系のようにログイン情報をセッションから取得できないのってJWT対応のためでしょうか?

ucmitz
https://github.com/baserproject/ucmitz/blob/8378dab56c3c031e09aba56fa41d1b586d19667d/plugins/baser-core/src/Utility/BcUtil.php#L133
4系
https://github.com/baserproject/basercms/blob/dev-4/lib/Baser/Lib/BcUtil.php#L67

@ryuring
Copy link
Collaborator

ryuring commented Mar 20, 2023

@seto1 JWTは関係ないですね。プレフィックス認証の仕様変更によるものです。
BcUtil::loginUser() について、仕様がふわふわしてしまっているのでカチっとさせたいところですが、歴史的な経緯からこっちを立てればあっちがダメになるという状況なので、仕方なくそういう挙動にしています。
もしカチっとしたものを作るのであれば別メソッドを改めて定義した方が安全だと考えています。

@seto1
Copy link
Collaborator Author

seto1 commented Mar 24, 2023

@ryuring 4系のloginUser = 5系のloginUserFromSessionなように思えてきました。
別メソッド作らなくてもこれで代用できそうです。
https://github.com/baserproject/ucmitz/blob/8378dab56c3c031e09aba56fa41d1b586d19667d/plugins/baser-core/src/Utility/BcUtil.php#L206

そうなると、loginUserの$prefix引数外したほうがよりすっきりしますね。

@ryuring
Copy link
Collaborator

ryuring commented Mar 27, 2023

@seto1 なるほど。

そうなると、loginUserの$prefix引数外したほうがよりすっきりしますね。

こちらも確かにそうですね。
呼び出し元がけっこうあったので、そちらを調査しつつ、可能であれば最終的には引数除外の方がよさそうですね。

@ryuring ryuring added the Adjusting 調整中 label Apr 15, 2023
@ryuring ryuring transferred this issue from baserproject/ucmitz Apr 16, 2023
@ryuring ryuring added the ver5 label Apr 16, 2023
@ryuring ryuring added this to the 5.0.1 milestone Apr 16, 2023
ryuring added a commit that referenced this issue Apr 17, 2023
Co-authored-by: Đỗ Văn Hùng <HungDV2022>
Co-authored-by: ryuring <egashira@catchup.co.jp>
seto1 added a commit to seto1/basercms that referenced this issue May 2, 2023
@ryuring ryuring closed this as completed in 52c1de8 May 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Adjusting 調整中 Bug バグ
Projects
None yet
Development

No branches or pull requests

2 participants