Skip to content

Commit

Permalink
Injections mit Level für Reihenfolge eingeführt
Browse files Browse the repository at this point in the history
  • Loading branch information
dergel committed Nov 15, 2024
1 parent 9e41775 commit 9f89a0b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
6 changes: 3 additions & 3 deletions boot.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
// include __DIR__.'/vendor/guzzlehttp/guzzle/src/functions_include.php';
//

rex_ycom_auth::addInjection(new rex_ycom_injection_termsofuse());
rex_ycom_auth::addInjection(new rex_ycom_injection_passwordchange());
rex_ycom_auth::addInjection(new rex_ycom_injection_otp());
rex_ycom_auth::addInjection(new rex_ycom_injection_otp(), 1);
rex_ycom_auth::addInjection(new rex_ycom_injection_passwordchange(), 4);
rex_ycom_auth::addInjection(new rex_ycom_injection_termsofuse(), 8);

if (rex::isBackend()) {
rex_extension::register('PACKAGES_INCLUDED', static function ($params) {
Expand Down
16 changes: 13 additions & 3 deletions plugins/auth/lib/ycom_auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,22 @@ class rex_ycom_auth

public static array $injections = [];

public static function addInjection(rex_ycom_injection_abtract $injection): void
public static function addInjection(rex_ycom_injection_abtract $injection, int $level = 1): void
{
self::$injections[] = $injection;
self::$injections[$level][] = $injection; // $level][
}

public static function getInjections(): array
{
return self::$injections;
$injections = [];
ksort(self::$injections);

foreach (self::$injections as $level => $injection) {
foreach ($injection as $inj) {
$injections[] = $inj;
}
}
return $injections;
}

public static function getRequestKey(string $requestKey): string
Expand Down Expand Up @@ -125,6 +133,8 @@ public static function init(): string
if (rex_plugin::get('ycom', 'auth')->getConfig('article_id_logout') == rex_article::getCurrentId()) {
// ignore rest - because logout is always ok .
} else {
// dd(self::getInjections());

foreach (self::getInjections() as $injection) {
$rewrite = $injection->getRewrite();
if ($rewrite && '' != $rewrite) {
Expand Down

0 comments on commit 9f89a0b

Please sign in to comment.