Created
July 12, 2018 19:47
-
-
Save williankeller/8eede31877f0e36283e08a83b28e2f80 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| public function afterGetUserId(\Magento\Webapi\Model\Authorization\TokenUserContext $subject, $result) | |
| { | |
| /** @param Request $requestHeader **/ | |
| $integration = $this->requestHeader->getHeader('custID'); | |
| if (!empty($integration)) { | |
| static $customer = null; | |
| if ($customer) { | |
| return $customer->getId(); | |
| } | |
| // Get customer account in Magento by integration ID. | |
| $customer = $this->accountManagement->getByMagento($integration); | |
| if (!empty($customer)) { | |
| return $customer->getId(); | |
| } | |
| } | |
| // Return default context ID. | |
| return $result; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment