Skip to content

Commit

Permalink
Merge pull request #3 from AOEpeople/patch-2
Browse files Browse the repository at this point in the history
Refactor the adapter to init frontend sessions
  • Loading branch information
Vinai committed Jul 30, 2015
2 parents 97db40c + 1cabf27 commit 7442f6e
Showing 1 changed file with 11 additions and 5 deletions.
Expand Up @@ -33,7 +33,7 @@ public function __construct($helper = null, $customerSession = null)
$this->_customerSession = $customerSession;
}
}

public function getHelper()
{
if (!$this->_helper) {
Expand Down Expand Up @@ -84,10 +84,16 @@ public function getUserParams(Mage_Api2_Model_Request $request)
public function isApplicableToRequest(Mage_Api2_Model_Request $request)
{
$helper = $this->getHelper();
if ($helper->hasFrontendSessionCookie()) {
$helper->startFrontendSession();
return $this->getCustomerSession()->isLoggedIn();

// This auth adapter is for frontend use only
if ($helper->getApp()->getStore()->isAdmin()) {
return false;
}
return false;

// Ensure frontend sessions are initialized using the proper cookie name
$helper->startFrontendSession();

// We are only applicable if the customer is logged in already
return $this->getCustomerSession()->isLoggedIn();
}
}

0 comments on commit 7442f6e

Please sign in to comment.