Commit graph

4413 commits

Author SHA1 Message Date
Alexander A. Klimov
844af8c17a Deprecate Module#provideHook() and Hook methods in favor of Hook\Essentials ones 2026-04-13 11:35:04 +02:00
Alexander A. Klimov
8533c5eea2 Use Hook\Essentials::all(), not Hook::all()
to ease finding usages and to be a good example for future hooks.

Same with `register()`, `first()` and `has()`.
2026-04-13 11:35:04 +02:00
Alexander A. Klimov
9fa78a1154 Use \Icinga\Application\Hook\Essentials in existing hooks 2026-04-13 11:34:47 +02:00
Alexander A. Klimov
ebc92b058c Introduce \Icinga\Application\Hook\Essentials 2026-04-13 11:34:47 +02:00
Eric Lippmann
b474b4347d Raise version to 2.13 2026-03-26 21:31:28 +01:00
Eric Lippmann
662de28f85 License source files as GPL-3.0-or-later
Add SPDX license headers and mark source files as GPL-3.0-or-later to
preserve the option to relicense under later GPL versions.
2026-03-26 17:49:26 +01:00
Eric Lippmann
eb378ca0dc
Replace incubator module with icinga-php-legacy library (#5484)
The `icinga-php-legacy` library is the successor to the standalone
`icingaweb2-module-incubator` module. Modules such as director and
vspheredb that still declare `incubator` as a dependency should load
without a separate incubator installation once `icinga-php-legacy` is
present.

`Module::getRequiredLibraries` now maps an `incubator` module
requirement to an `icinga-php-legacy` library requirement when that
library is available, and `getRequiredModules` drops `incubator` from
the list so the dependency check does not fail. `Manager::loadModule`
skips calling `register()` for the incubator module under the same
condition, folding that guard into the existing `ipl`/`reactbundle`
exclusion to avoid a double-registration.

https://github.com/Icinga/icinga-php-legacy replaces
https://github.com/Icinga/icingaweb2-module-incubator.
2026-03-26 17:23:38 +01:00
jrauh01
6ae99807b1
Add RequestHook (#5433) 2026-03-26 14:25:31 +01:00
jrauh01
158428fcae
Log user roles (#5311)
Log the roles assigned to a user during login in the debug log.
2026-03-25 15:19:54 +01:00
Eric Lippmann
298f52456f Use Pdo\Mysql driver-specific constants
Replace deprecated `PDO::MYSQL_*` constant usage with the driver-specific
`Pdo\Mysql::ATTR_*` constants introduced in PHP 8.4.

This prepares the code for PHP 8.5, where accessing MySQL driver constants
through the generic `PDO` class is deprecated.

This change requires a compatibility shim on older PHP versions to provide
`Pdo\Mysql` for runtimes that do not expose the driver-specific class yet.  The
shim is provided in `ipl-sql`. As a consequence, the required version of the
Icinga PHP library has been raised.
2026-03-19 22:27:45 +01:00
Bastian Lederer
007abed960 Avoid passing null to non-nullable parameters in built-in functions
PHP 8.1 deprecated passing `null` to non-nullable parameters in built-in
functions (deprecated in 8.1, will become a `TypeError` in 9.0).
2026-03-19 22:27:45 +01:00
Eric Lippmann
1c4460c67a tests: Use latest PHPUnit version 2026-03-19 22:27:45 +01:00
Bastian Lederer
21b50939e5 Avoid passing null as ipl\Html form element $name
Forward compatibility fix: `ipl\Html` will introduce strict types, which
declares `$name` as string. Passing `null` will result in a `TypeError` once
strict types are enforced.
2026-03-19 22:27:41 +01:00
Bastian Lederer
5b2747e9cd Only set session.sid_bits_per_character for PHP < 8.4
PHP 8.4 has deprecated `session.sid_bits_per_character` along with
`session.sid_length`, as part of a broader effort to standardize session ID
generation for improved security and interoperability.
2026-03-10 16:40:27 +01:00
Bastian Lederer
f868f4d9d6 Avoid passing null as key in array_key_exists()
Calling `array_key_exists()` with a `null` key is deprecated as of PHP 8.5.
2026-03-10 16:40:27 +01:00
Bastian Lederer
e9f6c7721d Remove no-op ReflectionProperty::setAccessible() calls
`ReflectionProperty::setAccessible()` has had no effect since PHP 8.1, as all
properties are accessible via reflection by default. The method is deprecated
as of PHP 8.5.
2026-03-10 16:40:27 +01:00
Bastian Lederer
ea0ce32bc9 Change implicit nullable type declaration to explicit
Since PHP 8.4 implicitly nullable parameter types are deprecated.

Normalize scoped PHPDoc for nullable-parameter updates: use `?Type` instead of
`Type|null`, remove column alignment, and indent continuation lines with 2
spaces.

Co-authored-by: "Eric Lippmann <eric.lippmann@icinga.com>"
2026-03-10 16:40:27 +01:00
Alexander Aleksandrovič Klimov
bc2d4a51c7
Shorten AuthenticationHook#onLogin() doc to avoid confusion (#5465)
Some checks failed
L10n Update / update (push) Has been cancelled
CI / PHP (push) Has been cancelled
"even if already authenticated in Icinga Web" already made one colleague
thinking `onLogin()` is called even during authentication from session.
Latter is not true and not desired by hook providers, e.g.
`icinga-notifications-web`.

Currently, as authenticated user, I can't even use
`/authentication/login`. It redirects me to the dashboard.
2026-03-10 15:51:33 +01:00
Alexander Aleksandrovič Klimov
4037eb51b1
LoginButtonHook: Support additional buttons below the login form (#5442)
Some checks failed
L10n Update / update (push) Has been cancelled
CI / PHP (push) Has been cancelled
Introduces `LoginButtonHook`, a new hook for rendering additional buttons
below the login form. Extend this class to display custom buttons on the
Icinga Web login page — useful for alternative authentication flows such
as SSO. Register your implementation by calling
`YourLoginButtons::register()` during module initialization.
2026-03-04 15:32:06 +01:00
jrauh01
33f0c4eba3
Use NotWritableError for ini config (#5404)
Replaced the unused `Zend_Config_Exception` with a more appropriate
`NotWritableError` in `IniWriter::write()`.

- The old `Zend_Config_Exception` was never caught anywhere in the
codebase.
- Changed to `NotWritableError` to better reflect file permission and
write issues.
- Added `@` suppression to the `file_put_contents()` call so that the
method can throw `NotWritableError` instead of crashing on PHP warnings.
2026-02-26 12:33:54 +01:00
Eric Lippmann
a73cd1c758
Introduce AuthenticationHook#onAuthFromSession() (#5467)
Some checks failed
L10n Update / update (push) Has been cancelled
CI / PHP (push) Has been cancelled
Especially useful for code not for ApplicationStateHook due to the fact
that a user can block requests to /application-state.
2026-01-28 09:59:08 +01:00
Alexander A. Klimov
352c79faf4 Introduce AuthenticationHook#onAuthFromSession()
Especially useful for code not suitable for ApplicationStateHook due to the fact that a user can block requests to /application-state.
2026-01-13 15:21:09 +01:00
Eric Lippmann
3b732c3ff9
Replace outdated test setup code with composer.json (#5445)
Some checks failed
L10n Update / update (push) Has been cancelled
PHP Tests / Static analysis for php 8.2 on ubuntu-latest (push) Has been cancelled
PHP Tests / Static analysis for php 8.3 on ubuntu-latest (push) Has been cancelled
PHP Tests / Static analysis for php 8.4 on ubuntu-latest (push) Has been cancelled
PHP Tests / Unit tests with php 8.2 on ubuntu-latest (push) Has been cancelled
PHP Tests / Unit tests with php 8.3 on ubuntu-latest (push) Has been cancelled
PHP Tests / Unit tests with php 8.4 on ubuntu-latest (push) Has been cancelled
This is preparation for a GitHub action to streamline tests, which
* expects the `phpunit.xml` configuration at the root level, and
* installs dependencies via `composer`.

Proof that the same number of tests are run after moving the
configuration file:
*
[main](https://github.com/Icinga/icingaweb2/actions/runs/18972121136/job/54182208796#step:6:243)
* [this
PR](https://github.com/Icinga/icingaweb2/actions/runs/19137281980/job/54692472598#step:6:243)

Rationale for introducing `composer`:

GitHub Actions for this repository and any other module that requires
Mockery must specify this dependency themselves. Module tests require
Icinga Web anyway, so all (development) dependencies and any changes to
them should be automatically applied instead of having to adjust each
individual module affected. If we eventually upload our library bundles
to Packagist as well, we could also specify them in `composer.json` once
instead of having to require them in every action.
2025-12-05 15:17:37 +01:00
Johannes Meyer
94561159a4 Raise version to 2.12.6 2025-11-18 17:35:08 +01:00
Gianluca Piccolo
eae7222ac7 Fix: add login hook to ext backends
Some checks failed
L10n Update / update (push) Has been cancelled
PHP Tests / Static analysis for php 8.2 on ubuntu-latest (push) Has been cancelled
PHP Tests / Static analysis for php 8.3 on ubuntu-latest (push) Has been cancelled
PHP Tests / Static analysis for php 8.4 on ubuntu-latest (push) Has been cancelled
PHP Tests / Unit tests with php 8.2 on ubuntu-latest (push) Has been cancelled
PHP Tests / Unit tests with php 8.3 on ubuntu-latest (push) Has been cancelled
PHP Tests / Unit tests with php 8.4 on ubuntu-latest (push) Has been cancelled
2025-11-13 09:20:43 +01:00
Eric Lippmann
eabb806f54 Remove obsolete method BaseTestCase::assertMatchesRegularExpression()
Else, tests with current PHPUnit versions fail with `Cannot override final
method PHPUnit\Framework\Assert::assertMatchesRegularExpression()`.
2025-11-06 14:35:55 +01:00
Alexander Aleksandrovič Klimov
8603044881 Fix typo in code comment 2025-08-22 15:46:59 +02:00
Alexander Aleksandrovič Klimov
2e164a75d4
Fix typo in code comment (#5327)
Co-authored-by: Johannes Meyer <johannes.meyer@icinga.com>
2025-08-22 12:01:01 +02:00
Jan Schuppik
ee3f3135b8 Fix: PHP built-in server detection for PHP 8.3 SERVER_SOFTWARE format 2025-08-20 09:30:54 +02:00
Johannes Meyer
5f602113ee Raise version to v2.12.5 2025-07-14 13:35:37 +02:00
Johannes Meyer
5d71d09e54 StyleSheet: Do not rely on config to trigger auth
fixes #5385
2025-07-08 16:47:02 +02:00
Johannes Rauh
aa7a60c893 Replace search icon png with fontawesome icon 2025-05-08 08:37:37 +02:00
Alexander Aleksandrovič Klimov
5333f2deb7
Disable deprecation warnings unless ICINGAWEB_ENVIRONMENT is set to "dev" (#5359)
in ApplicationBootstrap#setupErrorHandling(). In webrouter.php disable
them unconditionally (until ApplicationBootstrap#setupErrorHandling())
not to duplicate the check. ApplicationBootstrap#setupErrorHandling())
is called pretty early, so we won't miss much.

fixes #5117

* In addition, this provides #5269 and mitigates #5152 in production
where ICINGAWEB_ENVIRONMENT isn't set.
2025-05-05 17:58:28 +02:00
Johannes Rauh
05f9e7c5ee Show label as navigation flyout header 2025-04-30 15:29:59 +02:00
raviks789
380b3688bd
TimezoneDetect: Verify the timezone name cookie 2025-04-28 15:12:37 +02:00
raviks789
2d265babf7
Fix browser timezone information being lost 2025-04-24 10:23:46 +02:00
Silas
ff04a2ea43
Fix that CSV exports contain empty strings instead of zeros 2025-04-07 13:46:21 +02:00
Johannes Meyer
6c7f1e5466 Dashlet: Properly embed iframe urls
fixes #5346
2025-04-01 11:19:00 +02:00
Johannes Meyer
e98a776509 Raise version to 2.12.4 2025-03-26 16:41:23 +01:00
Johannes Meyer
1ddd04df50 DbUserBackend: Fix broken password hash fetch routine
fixes #5343
2025-03-26 16:40:48 +01:00
Johannes Meyer
01fb35dd4a Raise version to 2.12.3 2025-03-26 10:31:04 +01:00
Johannes Meyer
ec40efe157 Only open trusted iframe sources by default
Trusted in this case means, it was Icinga Web that
rendered a link and the user followed it. Whether
a source is trustworthy or not is detected by use
of the user's session id to hash it combined with
the source similar to how CSRF tokens are assembled.
2025-03-26 10:25:31 +01:00
Johannes Meyer
484bd26d63 Window: Only accept valid window IDs 2025-03-26 10:24:17 +01:00
Johannes Meyer
2b08d88edf Url: Always compare host and port to identify external urls 2025-03-26 10:23:31 +01:00
Johannes Meyer
191444ccd9 Pdf: Ensure dompdf can create temporary files
This is required since dompdf seems to automatically load
our custom font and complains otherwise.
2025-03-25 13:59:18 +01:00
Johannes Meyer
92dad17a2b DbUserGroupBackend: Match memberships case-insensitive on pgsql 2025-03-20 16:24:21 +01:00
Johannes Meyer
13c9a73842 DbUserBackend: Match usernames case-insensitive on pgsql 2025-03-20 16:24:21 +01:00
Sukhwinder Dhillon
c6c1e28350 RolesConfig: Add missing column name for quick search 2025-03-20 14:30:45 +01:00
Yoda-BZH
4eadfd0ace
View: Consider letter a legacy icon name 2024-11-28 16:55:59 +01:00
Johannes Meyer
b403918cc1 Raise version to 2.12.2 2024-11-13 09:59:05 +01:00