<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
heptacom / shopware-platform-admin-open-auth example snippets
namespace Heptacom\MyCustomPlugin\HeptacomOpenAuth;
use Heptacom\AdminOpenAuth\Contract\OAuthRuleScope;
use Heptacom\AdminOpenAuth\Contract\RuleActionInterface;
use Heptacom\AdminOpenAuth\Database\ClientRuleEntity;
class CustomRuleAction implements RuleActionInterface
{
public static function getName(): string
{
return 'heptacom_my_custom_action';
}
public function getActionConfigurationComponent(): string
{
return 'heptacom-my-custom-action-config';
}
public function preResolveUser(ClientRuleEntity $rule, OAuthRuleScope $ruleScope): void {
// your business logic here
}
public function postResolveUser(ClientRuleEntity $rule, OAuthRuleScope $ruleScope): void {
// your business logic here
}
}
namespace Heptacom\MyCustomPlugin\HeptacomOpenAuth;
use Heptacom\AdminOpenAuth\Contract\RuleActionInterface;
use Heptacom\AdminOpenAuth\Contract\OAuthRuleScope;
use Heptacom\AdminOpenAuth\Database\ClientRuleEntity;
use Psr\Log\LoggerInterface;
class CustomRuleAction implements RuleActionInterface
{
public function __construct(
private readonly LoggerInterface $logger
) {
}
// ...
public function preResolveUser(ClientRuleEntity $rule, OAuthRuleScope $ruleScope): void {
$this->logger->info(sprintf(
'My custom action (preResolveUser) was executed with text: %s',
$rule->getActionConfig()['myText']
));
}
public function postResolveUser(ClientRuleEntity $rule, OAuthRuleScope $ruleScope): void {
$this->logger->info(sprintf(
'My custom action (postResolveUser) was executed with text: %s',
$rule->getActionConfig()['myText']
));
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.