Skip to content

Commit

Permalink
#28563: GraphQL product search does not consider Category Permissions…
Browse files Browse the repository at this point in the history
… configuration - Pass the context as argument

Reveert AddUsserInfoToContext
  • Loading branch information
pmarjan committed Jul 8, 2020
1 parent a675e30 commit c689798
Showing 1 changed file with 1 addition and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
use Magento\Authorization\Model\UserContextInterface;
use Magento\GraphQl\Model\Query\ContextParametersInterface;
use Magento\GraphQl\Model\Query\ContextParametersProcessorInterface;
use Magento\Customer\Api\CustomerRepositoryInterface;
use Magento\Customer\Api\Data\GroupInterface;

/**
* @inheritdoc
Expand All @@ -23,21 +21,13 @@ class AddUserInfoToContext implements ContextParametersProcessorInterface
*/
private $userContext;

/**
* @var CustomerRepositoryInterface
*/
private $customerRepository;

/**
* @param UserContextInterface $userContext
* @param CustomerRepositoryInterface $customerRepository
*/
public function __construct(
UserContextInterface $userContext,
CustomerRepositoryInterface $customerRepository
UserContextInterface $userContext
) {
$this->userContext = $userContext;
$this->customerRepository = $customerRepository;
}

/**
Expand All @@ -58,15 +48,6 @@ public function execute(ContextParametersInterface $contextParameters): ContextP
$contextParameters->setUserType($currentUserType);

$contextParameters->addExtensionAttribute('is_customer', $this->isCustomer($currentUserId, $currentUserType));

try {
$customerGroupId = $this->customerRepository->getById($currentUserId)->getGroupId();
} catch (\Exception $e) {
$customerGroupId = GroupInterface::NOT_LOGGED_IN_ID;
}

$contextParameters->addExtensionAttribute('customer_group_id', $customerGroupId);

return $contextParameters;
}

Expand Down

0 comments on commit c689798

Please sign in to comment.