-
Notifications
You must be signed in to change notification settings - Fork 122
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
fix #1529 管理画面ログイン、ログアウト時の処理を拡張する為のイベントを追加 #1541
Conversation
@kaburk ありがとうございます。 プルリクの仕様は次となっているようです
|
@kaburk 実際の実務などでイベントの実装要件があったのかと思いますが、どういった要求しようでしたか?? |
イベントの実装として、基本的に、before の処理では、本体に影響を与えることができて、after では影響はない処理にすると仕様がスッキリするかと思います。 |
@kaburk こちら次のバージョンで取り込みましょう。 |
|
||
// EVENT Users.beforeLogin | ||
$event = $this->dispatchEvent('beforeLogin', [ | ||
'data' => $this->request->data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
キーを user
にしましょう
|
||
// EVENT Users.afterLogin | ||
$this->dispatchEvent('afterLogin', [ | ||
'data' => $this->request->data, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
data
は除外
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
loginRedirect
を追加
@@ -170,6 +185,12 @@ public function admin_ajax_agent_login($id) { | |||
$this->Session->write('AuthAgent', $user); | |||
} | |||
|
|||
// EVENT Users.beforeAgentLogin | |||
$event = $this->dispatchEvent('beforeAgentLogin', [ | |||
'data' => $id, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
beforeUser
、afterUser
を引き渡して、代理ログインユーザーを afterUser
で書き換える
@@ -179,6 +200,13 @@ public function admin_ajax_agent_login($id) { | |||
if ($user) { | |||
$this->Session->renew(); | |||
$this->Session->write(BcAuthComponent::$sessionKey, $user); | |||
|
|||
// EVENT Users.afterAgentLogin | |||
$this->dispatchEvent('afterAgentLogin', [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
beforeUser
、afterUser
を引き渡す
|
||
// EVENT Users.beforeBackAgent | ||
$event = $this->dispatchEvent('beforeBackAgent', [ | ||
'data' => $data, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
beforeUser
、afterUser
を引き渡して、元ログインユーザーを afterUser
で書き換える
|
||
// EVENT Users.afterBackAgent | ||
$event = $this->dispatchEvent('afterBackAgent', [ | ||
'data' => $authPrefix, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
data
をauthPrefix
に変更
|
||
// EVENT Users.beforeLogout | ||
$event = $this->dispatchEvent('beforeLogout', [ | ||
'data' => $this->BcAuth->user(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
data
を user
に変更
|
||
// EVENT Users.afterLogout | ||
$event = $this->dispatchEvent('afterLogout', [ | ||
'data' => $logoutRedirect, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logoutRedirect
に変更
@kaburk レビューが中途半端になってて送信できてなかったので送りました。 |
issues #1529 の件の管理画面ログイン、ログアウト前後のイベントを追加してみました。
よろしくお願いいたします。