Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 27 additions & 5 deletions assets/views/settings.view.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
?>

<div class="wrap">
<h1><?php esc_html_e('Signicat Simulator', 'owc-signicat-openid'); ?></h1>
<h1><?php esc_html_e('Signicat Simulator', 'owc-spoof-openid'); ?></h1>

<p>Nog geen Signicat aansluiting gerealiseerd? Worry no more! Met de <em>Signicat Simulator 2000™</em> kun je net doen alsof je ingelogd bent op DigiD of eHerkenning!</p>

Expand Down Expand Up @@ -56,11 +56,11 @@
</label>
</td>
</tr>

<tr>
<th scope="row">
<label for="owc_spoof_openid_bsn">
<?php esc_html_e('BSN-nummer', 'owc-signicat-openid'); ?>
<?php esc_html_e('BSN-nummer', 'owc-spoof-openid'); ?>
</label>
</th>
<td>
Expand All @@ -71,14 +71,36 @@
<tr>
<th scope="row">
<label for="owc_spoof_openid_kvk">
<?php esc_html_e('KvK-nummer', 'owc-signicat-openid'); ?>
<?php esc_html_e('KvK-nummer', 'owc-spoof-openid'); ?>
</label>
</th>
<td>
<input type="number" min="0" name="owc_spoof_openid_kvk" id="owc_spoof_openid_kvk" value="<?php echo esc_attr($this->settings->getKvk()); ?>">
</td>
</tr>

<tr>
<th scope="row">
<label for="owc_spoof_openid_vestigings_nummer">
<?php esc_html_e('Vestigingsnummer', 'owc-spoof-openid'); ?>
</label>
</th>
<td>
<input type="number" min="0" name="owc_spoof_openid_vestigings_nummer" id="owc_spoof_openid_vestigings_nummer" value="<?php echo esc_attr($this->settings->getVestigingsNummer()); ?>">
</td>
</tr>

<tr>
<th scope="row">
<label for="owc_spoof_openid_rsin">
<?php esc_html_e('RSIN-nummer', 'owc-spoof-openid'); ?>
</label>
</th>
<td>
<input type="number" min="0" name="owc_spoof_openid_rsin" id="owc_spoof_openid_rsin" value="<?php echo esc_attr($this->settings->getRsin()); ?>">
</td>
</tr>

</table>
<?php submit_button(); ?>
</form>
Expand All @@ -89,4 +111,4 @@
display: block;
padding: 0.3em 0;
}
</style>
</style>
7 changes: 5 additions & 2 deletions src/ServiceProviders/SpoofService.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,13 @@ protected function enableEHerkenningSpoof(): void
return;
}

$vestigingsNummer = $this->settings->getVestigingsNummer();
$rsin = $this->settings->getRsin();

add_filter('owc_eherkenning_is_logged_in', fn (bool $isLoggedIn): bool => true, 999);

add_filter('owc_eherkenning_userdata', function (?UserDataInterface $userData) use ($kvk) {
return new EHerkenning($kvk);
add_filter('owc_eherkenning_userdata', function (?UserDataInterface $userData) use ($kvk, $vestigingsNummer, $rsin) {
return new EHerkenning($kvk, $vestigingsNummer, $rsin);
}, 999);
}
}
11 changes: 10 additions & 1 deletion src/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Settings
public const USERLEVEL_GUEST = 'guest';

protected array $knownSettings = [
'enable_simulator', 'userlevel', 'bsn', 'kvk'
'enable_simulator', 'userlevel', 'bsn', 'kvk', 'vestigings_nummer', 'rsin',
];

public function get(string $name): mixed
Expand Down Expand Up @@ -65,6 +65,15 @@ public function getKvk(): string
return (string) $this->get('kvk');
}

public function getVestigingsNummer(): string
{
return (string) $this->get('vestigings_nummer');
}

public function getRsin(): string
{
return (string) $this->get('rsin');
}

public function getKnownSettings(): array
{
Expand Down
16 changes: 15 additions & 1 deletion src/UserData/EHerkenning.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,28 @@
class EHerkenning implements eHerkenningUserDataInterface
{
protected string $kvk;
protected string $vestigingsNummer;
protected string $rsin;

public function __construct(string $kvk)
public function __construct(string $kvk, string $vestigingsNummer, string $rsin)
{
$this->kvk = $kvk;
$this->vestigingsNummer = $vestigingsNummer;
$this->rsin = $rsin;
}

public function getKvk(): string
{
return $this->kvk;
}

public function getVestigingsNummer(): string
{
return $this->vestigingsNummer;
}

public function getRsin(): string
{
return $this->rsin;
}
}