diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 7bf7a47..968e32b 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -20,7 +20,7 @@ jobs: name: "Generate CI matrix" uses: "glpi-project/plugin-ci-workflows/.github/workflows/generate-ci-matrix.yml@v1" with: - glpi-version: "11.0.x" + glpi-version: "12.0.x" ci: name: "GLPI ${{ matrix.glpi-version }} - php:${{ matrix.php-version }} - ${{ matrix.db-image }}" needs: "generate-ci-matrix" diff --git a/CHANGELOG.md b/CHANGELOG.md index 92a7402..c658e95 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). -## [Unreleased] +## [UNRELEASED] + +### Added + +- GLPI 12 compatibility ### Fixed diff --git a/ajax/dropdownReplaceFindDevice.php b/ajax/dropdownReplaceFindDevice.php index f2528de..94780bd 100644 --- a/ajax/dropdownReplaceFindDevice.php +++ b/ajax/dropdownReplaceFindDevice.php @@ -36,7 +36,7 @@ header("Content-Type: text/html; charset=UTF-8"); Html::header_nocache(); -Session::checkRightsOr('uninstall:profile', [READ, PluginUninstallProfile::RIGHT_REPLACE]); +Session::checkRightsOr(PluginUninstallPreference::$rightname, [READ, PluginUninstallProfile::RIGHT_REPLACE]); /** * @var array $UNINSTALL_TYPES diff --git a/composer.json b/composer.json index 8b1e015..5881de2 100644 --- a/composer.json +++ b/composer.json @@ -2,9 +2,6 @@ "require": { "php": ">=8.2" }, - "require-dev": { - "glpi-project/tools": "^0.8" - }, "config": { "optimize-autoloader": true, "platform": { diff --git a/composer.lock b/composer.lock index 1adb59c..e798ec8 100644 --- a/composer.lock +++ b/composer.lock @@ -4,881 +4,9 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "0bb7734a8837cdd118f20d259d3613e7", + "content-hash": "4cacb822b12bf0d2a0dbcf952b20ef7b", "packages": [], - "packages-dev": [ - { - "name": "glpi-project/tools", - "version": "0.8.3", - "source": { - "type": "git", - "url": "https://github.com/glpi-project/tools.git", - "reference": "8ea2a7d4702a858f4b0360ba7d4f1841a5e77026" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/glpi-project/tools/zipball/8ea2a7d4702a858f4b0360ba7d4f1841a5e77026", - "reference": "8ea2a7d4702a858f4b0360ba7d4f1841a5e77026", - "shasum": "" - }, - "require": { - "symfony/console": "^5.4 || ^6.0", - "twig/twig": "^3.3" - }, - "require-dev": { - "nikic/php-parser": "^4.13", - "phpstan/phpstan-src": "^1.10" - }, - "bin": [ - "bin/extract-locales", - "bin/licence-headers-check", - "tools/plugin-release" - ], - "type": "library", - "autoload": { - "psr-4": { - "GlpiProject\\Tools\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "GPL-3.0-or-later" - ], - "authors": [ - { - "name": "Teclib'", - "email": "glpi@teclib.com", - "homepage": "http://teclib-group.com" - } - ], - "description": "Various tools for GLPI and its plugins", - "keywords": [ - "glpi", - "plugins", - "tools" - ], - "support": { - "issues": "https://github.com/glpi-project/tools/issues", - "source": "https://github.com/glpi-project/tools" - }, - "time": "2025-10-14T10:26:06+00:00" - }, - { - "name": "psr/container", - "version": "2.0.2", - "source": { - "type": "git", - "url": "https://github.com/php-fig/container.git", - "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963", - "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963", - "shasum": "" - }, - "require": { - "php": ">=7.4.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Container\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "https://www.php-fig.org/" - } - ], - "description": "Common Container Interface (PHP FIG PSR-11)", - "homepage": "https://github.com/php-fig/container", - "keywords": [ - "PSR-11", - "container", - "container-interface", - "container-interop", - "psr" - ], - "support": { - "issues": "https://github.com/php-fig/container/issues", - "source": "https://github.com/php-fig/container/tree/2.0.2" - }, - "time": "2021-11-05T16:47:00+00:00" - }, - { - "name": "symfony/console", - "version": "v6.4.43", - "source": { - "type": "git", - "url": "https://github.com/symfony/console.git", - "reference": "3b643aa587acbc42f967a429af088a56ed8f046d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/3b643aa587acbc42f967a429af088a56ed8f046d", - "reference": "3b643aa587acbc42f967a429af088a56ed8f046d", - "shasum": "" - }, - "require": { - "php": ">=8.1", - "symfony/deprecation-contracts": "^2.5|^3", - "symfony/polyfill-mbstring": "~1.0", - "symfony/service-contracts": "^2.5|^3", - "symfony/string": "^5.4|^6.0|^7.0" - }, - "conflict": { - "symfony/dependency-injection": "<5.4", - "symfony/dotenv": "<5.4", - "symfony/event-dispatcher": "<5.4", - "symfony/lock": "<5.4", - "symfony/process": "<5.4" - }, - "provide": { - "psr/log-implementation": "1.0|2.0|3.0" - }, - "require-dev": { - "psr/log": "^1|^2|^3", - "symfony/config": "^5.4|^6.0|^7.0", - "symfony/dependency-injection": "^5.4|^6.0|^7.0", - "symfony/event-dispatcher": "^5.4|^6.0|^7.0", - "symfony/http-foundation": "^6.4|^7.0", - "symfony/http-kernel": "^6.4|^7.0", - "symfony/lock": "^5.4|^6.0|^7.0", - "symfony/messenger": "^5.4|^6.0|^7.0", - "symfony/process": "^5.4|^6.0|^7.0", - "symfony/stopwatch": "^5.4|^6.0|^7.0", - "symfony/var-dumper": "^5.4|^6.0|^7.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\Console\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Eases the creation of beautiful and testable command line interfaces", - "homepage": "https://symfony.com", - "keywords": [ - "cli", - "command-line", - "console", - "terminal" - ], - "support": { - "source": "https://github.com/symfony/console/tree/v6.4.43" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://github.com/nicolas-grekas", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2026-07-26T14:44:19+00:00" - }, - { - "name": "symfony/deprecation-contracts", - "version": "v3.7.1", - "source": { - "type": "git", - "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "f3202fa1b5097b0af062dc978b32ecf63404e31d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/f3202fa1b5097b0af062dc978b32ecf63404e31d", - "reference": "f3202fa1b5097b0af062dc978b32ecf63404e31d", - "shasum": "" - }, - "require": { - "php": ">=8.1" - }, - "type": "library", - "extra": { - "thanks": { - "url": "https://github.com/symfony/contracts", - "name": "symfony/contracts" - }, - "branch-alias": { - "dev-main": "3.7-dev" - } - }, - "autoload": { - "files": [ - "function.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "A generic function and convention to trigger deprecation notices", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v3.7.1" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://github.com/nicolas-grekas", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2026-06-05T06:23:12+00:00" - }, - { - "name": "symfony/polyfill-ctype", - "version": "v1.37.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "141046a8f9477948ff284fa65be2095baafb94f2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/141046a8f9477948ff284fa65be2095baafb94f2", - "reference": "141046a8f9477948ff284fa65be2095baafb94f2", - "shasum": "" - }, - "require": { - "php": ">=7.2" - }, - "provide": { - "ext-ctype": "*" - }, - "suggest": { - "ext-ctype": "For best performance" - }, - "type": "library", - "extra": { - "thanks": { - "url": "https://github.com/symfony/polyfill", - "name": "symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Gert de Pagter", - "email": "BackEndTea@gmail.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for ctype functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "ctype", - "polyfill", - "portable" - ], - "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.37.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://github.com/nicolas-grekas", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2026-04-10T16:19:22+00:00" - }, - { - "name": "symfony/polyfill-intl-grapheme", - "version": "v1.41.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "bb899c1db0aa8127dc3afe8cda4a67eb24915f8d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/bb899c1db0aa8127dc3afe8cda4a67eb24915f8d", - "reference": "bb899c1db0aa8127dc3afe8cda4a67eb24915f8d", - "shasum": "" - }, - "require": { - "php": ">=7.2" - }, - "suggest": { - "ext-intl": "For best performance" - }, - "type": "library", - "extra": { - "thanks": { - "url": "https://github.com/symfony/polyfill", - "name": "symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Intl\\Grapheme\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for intl's grapheme_* functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "grapheme", - "intl", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.41.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://github.com/nicolas-grekas", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2026-07-28T08:25:59+00:00" - }, - { - "name": "symfony/polyfill-intl-normalizer", - "version": "v1.38.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "2d446c214bdbe5b71bde5011b060a05fece3ae6b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/2d446c214bdbe5b71bde5011b060a05fece3ae6b", - "reference": "2d446c214bdbe5b71bde5011b060a05fece3ae6b", - "shasum": "" - }, - "require": { - "php": ">=7.2" - }, - "suggest": { - "ext-intl": "For best performance" - }, - "type": "library", - "extra": { - "thanks": { - "url": "https://github.com/symfony/polyfill", - "name": "symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Intl\\Normalizer\\": "" - }, - "classmap": [ - "Resources/stubs" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for intl's Normalizer class and related functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "intl", - "normalizer", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.38.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://github.com/nicolas-grekas", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2026-05-25T13:48:31+00:00" - }, - { - "name": "symfony/polyfill-mbstring", - "version": "v1.38.2", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "d3d318bad5e7a1bfbd026009c8bfb8d8f99ae6b6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/d3d318bad5e7a1bfbd026009c8bfb8d8f99ae6b6", - "reference": "d3d318bad5e7a1bfbd026009c8bfb8d8f99ae6b6", - "shasum": "" - }, - "require": { - "ext-iconv": "*", - "php": ">=7.2" - }, - "provide": { - "ext-mbstring": "*" - }, - "suggest": { - "ext-mbstring": "For best performance" - }, - "type": "library", - "extra": { - "thanks": { - "url": "https://github.com/symfony/polyfill", - "name": "symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for the Mbstring extension", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "mbstring", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.38.2" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://github.com/nicolas-grekas", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2026-05-27T06:59:30+00:00" - }, - { - "name": "symfony/service-contracts", - "version": "v3.7.1", - "source": { - "type": "git", - "url": "https://github.com/symfony/service-contracts.git", - "reference": "c0a284bab1ed8aa0417e3d69250ab437739563a0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/c0a284bab1ed8aa0417e3d69250ab437739563a0", - "reference": "c0a284bab1ed8aa0417e3d69250ab437739563a0", - "shasum": "" - }, - "require": { - "php": ">=8.1", - "psr/container": "^1.1|^2.0", - "symfony/deprecation-contracts": "^2.5|^3" - }, - "conflict": { - "ext-psr": "<1.1|>=2" - }, - "type": "library", - "extra": { - "thanks": { - "url": "https://github.com/symfony/contracts", - "name": "symfony/contracts" - }, - "branch-alias": { - "dev-main": "3.7-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Contracts\\Service\\": "" - }, - "exclude-from-classmap": [ - "/Test/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Generic abstractions related to writing services", - "homepage": "https://symfony.com", - "keywords": [ - "abstractions", - "contracts", - "decoupling", - "interfaces", - "interoperability", - "standards" - ], - "support": { - "source": "https://github.com/symfony/service-contracts/tree/v3.7.1" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://github.com/nicolas-grekas", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2026-06-16T09:55:08+00:00" - }, - { - "name": "symfony/string", - "version": "v7.4.15", - "source": { - "type": "git", - "url": "https://github.com/symfony/string.git", - "reference": "e394af32256bf9e7bf80849d95e589167c10097b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/e394af32256bf9e7bf80849d95e589167c10097b", - "reference": "e394af32256bf9e7bf80849d95e589167c10097b", - "shasum": "" - }, - "require": { - "php": ">=8.2", - "symfony/deprecation-contracts": "^2.5|^3.0", - "symfony/polyfill-ctype": "~1.8", - "symfony/polyfill-intl-grapheme": "~1.33", - "symfony/polyfill-intl-normalizer": "~1.0", - "symfony/polyfill-mbstring": "~1.0" - }, - "conflict": { - "symfony/translation-contracts": "<2.5" - }, - "require-dev": { - "symfony/emoji": "^7.1|^8.0", - "symfony/http-client": "^6.4|^7.0|^8.0", - "symfony/intl": "^6.4|^7.0|^8.0", - "symfony/translation-contracts": "^2.5|^3.0", - "symfony/var-exporter": "^6.4|^7.0|^8.0" - }, - "type": "library", - "autoload": { - "files": [ - "Resources/functions.php" - ], - "psr-4": { - "Symfony\\Component\\String\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way", - "homepage": "https://symfony.com", - "keywords": [ - "grapheme", - "i18n", - "string", - "unicode", - "utf-8", - "utf8" - ], - "support": { - "source": "https://github.com/symfony/string/tree/v7.4.15" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://github.com/nicolas-grekas", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2026-07-28T07:33:02+00:00" - }, - { - "name": "twig/twig", - "version": "v3.28.0", - "source": { - "type": "git", - "url": "https://github.com/twigphp/Twig.git", - "reference": "597c12ed286fb9d1701a36684ce6e0cbe28ebc8b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/597c12ed286fb9d1701a36684ce6e0cbe28ebc8b", - "reference": "597c12ed286fb9d1701a36684ce6e0cbe28ebc8b", - "shasum": "" - }, - "require": { - "php": ">=8.1.0", - "symfony/deprecation-contracts": "^2.5|^3", - "symfony/polyfill-ctype": "^1.8", - "symfony/polyfill-mbstring": "^1.3" - }, - "require-dev": { - "php-cs-fixer/shim": "^3.0@stable", - "phpstan/phpstan": "^2.0@stable", - "psr/container": "^1.0|^2.0", - "symfony/phpunit-bridge": "^5.4.9|^6.4|^7.0" - }, - "type": "library", - "autoload": { - "files": [ - "src/Resources/core.php", - "src/Resources/debug.php", - "src/Resources/escaper.php", - "src/Resources/string_loader.php" - ], - "psr-4": { - "Twig\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com", - "homepage": "http://fabien.potencier.org", - "role": "Lead Developer" - }, - { - "name": "Twig Team", - "role": "Contributors" - }, - { - "name": "Armin Ronacher", - "email": "armin.ronacher@active-4.com", - "role": "Project Founder" - } - ], - "description": "Twig, the flexible, fast, and secure template language for PHP", - "homepage": "https://twig.symfony.com", - "keywords": [ - "templating" - ], - "support": { - "issues": "https://github.com/twigphp/Twig/issues", - "source": "https://github.com/twigphp/Twig/tree/v3.28.0" - }, - "funding": [ - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/twig/twig", - "type": "tidelift" - } - ], - "time": "2026-07-03T20:44:34+00:00" - } - ], + "packages-dev": [], "aliases": [], "minimum-stability": "stable", "stability-flags": {}, diff --git a/front/config.form.php b/front/config.form.php index 5c6dad1..5a9fabb 100644 --- a/front/config.form.php +++ b/front/config.form.php @@ -28,7 +28,7 @@ * ------------------------------------------------------------------------- */ -Session::checkRight('config', UPDATE); +Session::checkRight(Config::$rightname, UPDATE); /** @var array $CFG_GLPI */ global $CFG_GLPI; diff --git a/front/model.form.php b/front/model.form.php index 5417965..71e472d 100644 --- a/front/model.form.php +++ b/front/model.form.php @@ -30,7 +30,7 @@ use Glpi\Exception\Http\AccessDeniedHttpException; -Session::checkRightsOr('uninstall:profile', [READ, PluginUninstallProfile::RIGHT_REPLACE]); +Session::checkRightsOr(PluginUninstallPreference::$rightname, [READ, PluginUninstallProfile::RIGHT_REPLACE]); if (!isset($_GET["withtemplate"])) { $_GET["withtemplate"] = ""; @@ -68,7 +68,7 @@ ); if ($model->getFromDB($id) && $model->fields['types_id'] == PluginUninstallModel::TYPE_MODEL_REPLACEMENT && !Session::haveRight( - 'uninstall:profile', + PluginUninstallPreference::$rightname, PluginUninstallProfile::RIGHT_REPLACE, )) { throw new AccessDeniedHttpException(); diff --git a/inc/config.class.php b/inc/config.class.php index 28c7780..bce6794 100644 --- a/inc/config.class.php +++ b/inc/config.class.php @@ -49,8 +49,8 @@ public static function getConfig() public function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) { - if ($item->getType() === "Config") { - return self::createTabEntry(self::getTypeName(), 0, $item::getType(), PluginUninstallReplace::getIcon()); + if ($item::class === "Config") { + return self::createTabEntry(self::getTypeName(), 0, $item::class, PluginUninstallReplace::getIcon()); } return ''; diff --git a/inc/model.class.php b/inc/model.class.php index 33e7da2..dd9b0af 100644 --- a/inc/model.class.php +++ b/inc/model.class.php @@ -32,9 +32,9 @@ class PluginUninstallModel extends CommonDBTM { - public static $rightname = "uninstall:profile"; + public static string $rightname = "uninstall:profile"; - public $dohistory = true; + public bool $dohistory = true; public $first_level_menu = "plugins"; @@ -68,7 +68,7 @@ public static function canCreate(): bool public static function canReplace() { - return (bool) Session::haveRight(self::$rightname, PluginUninstallProfile::RIGHT_REPLACE); + return Session::haveRight(self::$rightname, PluginUninstallProfile::RIGHT_REPLACE); } public static function getMenuContent() @@ -197,12 +197,12 @@ public static function getMethodReplacement($value = 0) public function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) { - switch ($item->getType()) { + switch ($item::class) { case 'Preference': return PluginUninstallUninstall::getTypeName(1); case self::class: - return [1 => self::createTabEntry(self::getTypeName(1), 0, $item::getType(), self::getIcon()), 2 => self::createTabEntry(__s('Replacing data', 'uninstall'), 0, $item::getType(), PluginUninstallReplace::getIcon())]; + return [1 => self::createTabEntry(self::getTypeName(1), 0, $item::class, self::getIcon()), 2 => self::createTabEntry(__s('Replacing data', 'uninstall'), 0, $item::class, PluginUninstallReplace::getIcon())]; } return ''; @@ -328,7 +328,7 @@ public function showForm($ID, $options = []) if ( !Session::isMultiEntitiesMode() - && Session::haveRight("transfer", READ) + && Session::haveRight(Transfer::$rightname, READ) ) { echo ""; echo ""; @@ -632,7 +632,7 @@ public function rawSearchOptions() 'field' => 'name', 'name' => __s('Name'), 'datatype' => 'itemlink', - 'itemlink_type' => $this->getType(), + 'itemlink_type' => static::class, 'autocomplete' => true, ]; @@ -1346,7 +1346,7 @@ public function getSpecificMassiveActions($checkitem = null) $isadmin = static::canUpdate(); $actions = parent::getSpecificMassiveActions($checkitem); - if ($isadmin && (Session::haveRight('transfer', READ) && Session::isMultiEntitiesMode())) { + if ($isadmin && (Session::haveRight(Transfer::$rightname, READ) && Session::isMultiEntitiesMode())) { $actions['PluginUninstallModel:transfert'] = __s('Transfer'); } @@ -1370,7 +1370,7 @@ public static function processMassiveActionsForOneItemtype(MassiveAction $ma, Co "entities_id" => $entities_id, "update" => __s('Update'), ]); - $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_OK); + $ma->itemDone($item::class, $id, MassiveAction::ACTION_OK); } } diff --git a/inc/preference.class.php b/inc/preference.class.php index 52afa9a..beb9319 100644 --- a/inc/preference.class.php +++ b/inc/preference.class.php @@ -30,7 +30,7 @@ class PluginUninstallPreference extends CommonDBTM { - public static $rightname = "uninstall:profile"; + public static string $rightname = "uninstall:profile"; public function prepareInputForAdd($input) { @@ -255,8 +255,8 @@ public static function getLocationByUserByEntity($user_id, $template, $entity) public function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) { - if ($item->getType() == 'Preference' && Session::haveRight('uninstall:profile', READ)) { - return self::createTabEntry(PluginUninstallUninstall::getTypeName(), 0, $item::getType(), PluginUninstallReplace::getIcon()); + if ($item::class == 'Preference' && Session::haveRight(self::$rightname, READ)) { + return self::createTabEntry(PluginUninstallUninstall::getTypeName(), 0, $item::class, PluginUninstallReplace::getIcon()); } return ''; @@ -265,7 +265,7 @@ public function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) public static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0) { - if ($item->getType() == 'Preference' && Session::haveRight('uninstall:profile', READ)) { + if ($item::class == 'Preference' && Session::haveRight(self::$rightname, READ)) { $pref = new self(); $pref->showFormUserPreferences(); } diff --git a/inc/profile.class.php b/inc/profile.class.php index c2c2a90..1e1f2e0 100644 --- a/inc/profile.class.php +++ b/inc/profile.class.php @@ -181,7 +181,7 @@ public function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) { if ($item instanceof Profile && $item->getField('interface') == 'central') { - return self::createTabEntry(PluginUninstallUninstall::getTypeName(), 0, $item::getType(), PluginUninstallReplace::getIcon()); + return self::createTabEntry(PluginUninstallUninstall::getTypeName(), 0, $item::class, PluginUninstallReplace::getIcon()); } return ''; diff --git a/inc/replace.class.php b/inc/replace.class.php index 15839d1..b030514 100644 --- a/inc/replace.class.php +++ b/inc/replace.class.php @@ -71,7 +71,7 @@ class PluginUninstallReplace extends CommonDBTM public const METHOD_KEEP_AND_COMMENT = 3; - public static $rightname = "uninstall:profile"; + public static string $rightname = "uninstall:profile"; public static function getTypeName($nb = 0) { @@ -360,7 +360,7 @@ public static function replace($type, $model_id, $tab_ids, $location): int $resa_new = new ReservationItem(); $resa_new->getFromDBbyItem($type, $newitem_id); - if (count($resa_new->fields)) { + if ($resa_new->fields !== []) { $resa_new->deleteFromDB(true); } } @@ -374,7 +374,7 @@ public static function replace($type, $model_id, $tab_ids, $location): int $resa_old = new ReservationItem(); $resa_old->getFromDBbyItem($type, $olditem_id); - if (count($resa_old->fields)) { + if ($resa_old->fields !== []) { $resa_old->update( ['id' => $resa_old->getID(), 'itemtype' => $type, @@ -937,12 +937,12 @@ public static function getAssociatedDocuments(CommonDBTM $item, $withtemplate = return []; } - switch ($item->getType()) { + switch ($item::class) { case 'Ticket': case 'KnowbaseItem': break; default: - if (Session::haveRight('document', READ)) { + if (Session::haveRight(Document::$rightname, READ)) { return []; } } @@ -971,7 +971,7 @@ public static function getAssociatedDocuments(CommonDBTM $item, $withtemplate = ], 'WHERE' => [ 'glpi_documents_items.items_id' => $item->getField('id'), - 'glpi_documents_items.itemtype' => $item->getType(), + 'glpi_documents_items.itemtype' => $item::class, ], ]; @@ -1005,7 +1005,7 @@ public static function getAssociatedContracts(CommonDBTM $item) $contracts = []; - if (!Session::haveRight("contract", READ) || !$item->can($item->fields['id'], READ)) { + if (!Session::haveRight(Contract::$rightname, READ) || !$item->can($item->fields['id'], READ)) { return []; } @@ -1028,7 +1028,7 @@ public static function getAssociatedContracts(CommonDBTM $item) ], 'WHERE' => [ 'glpi_contracts_items.items_id' => $item->getField('id'), - 'glpi_contracts_items.itemtype' => $item->getType(), + 'glpi_contracts_items.itemtype' => $item::class, ] + getEntitiesRestrictCriteria('glpi_contracts', '', '', true), ]; $it = $DB->request($criteria); @@ -1054,7 +1054,7 @@ public static function getAssociatedTickets($itemtype, $items_id) global $DB; if ( - !Session::haveRight("ticket", Ticket::READALL) + !Session::haveRight(Ticket::$rightname, Ticket::READALL) || !($item = getItemForItemtype($itemtype)) ) { return []; @@ -1103,7 +1103,7 @@ public static function getAssociatedNetports($itemtype, $ID) return false; } - if (!Session::haveRight('networking', READ) || !$item->can($ID, READ)) { + if (!Session::haveRight(NetworkPort::$rightname, READ) || !$item->can($ID, READ)) { return false; } diff --git a/inc/uninstall.class.php b/inc/uninstall.class.php index 2757eb0..ee07791 100644 --- a/inc/uninstall.class.php +++ b/inc/uninstall.class.php @@ -64,7 +64,7 @@ class PluginUninstallUninstall extends CommonDBTM { public const PLUGIN_UNINSTALL_TRANSFER_NAME = "plugin_uninstall"; - public static $rightname = "uninstall:profile"; + public static string $rightname = "uninstall:profile"; public static function getTypeName($nb = 0) { @@ -120,9 +120,9 @@ public static function processMassiveActionsForOneItemtype(MassiveAction $ma, Co if ($item->getFromDB($id) && $item->can($id, UPDATE)) { //Session::addMessageAfterRedirect(sprintf(__s('Form duplicated: %s', 'formcreator'), $item->getName())); $_SESSION['glpi_uninstalllist'][$itemtype][$id] = $id; - $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_OK); + $ma->itemDone($item::class, $id, MassiveAction::ACTION_OK); } else { - $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_NORIGHT); + $ma->itemDone($item::class, $id, MassiveAction::ACTION_NORIGHT); } } @@ -139,7 +139,7 @@ private static function doOneUninstall(PluginUninstallModel $model, Transfer $tr global $UNINSTALL_DIRECT_CONNECTIONS_TYPE; $id = $item->fields['id']; - $type = $options['type'] ?? $item::getType(); + $type = $options['type'] ?? $item::class; $location = $options['location'] ?? ''; $plug = new Plugin(); @@ -223,7 +223,7 @@ private static function doOneUninstall(PluginUninstallModel $model, Transfer $tr ); if ( ($model->fields["groups_action"] === 'set') - && ($nbgroup == 1 || $model->fields["groups_id"] == 0) + && ($nbgroup === 1 || $model->fields["groups_id"] == 0) ) { // If a new group is defined and if the group is accessible in the object's entity $fields["groups_id"] = $model->fields["groups_id"]; @@ -600,7 +600,7 @@ public static function deleteGlpiInventoryLink($item) $agent = new Agent(); $agent->deleteByCriteria( [ - 'itemtype' => $item->getType(), + 'itemtype' => $item::class, 'items_id' => $item->getID(), ], true, @@ -612,7 +612,7 @@ public static function deleteGlpiInventoryLink($item) $computer_item->deleteByCriteria( [ 'items_id_asset' => $item->getID(), - 'itemtype_asset' => $item->getType(), + 'itemtype_asset' => $item::class, 'is_dynamic' => 1, ], true, @@ -626,7 +626,7 @@ public static function deleteGlpiInventoryLink($item) // manage networkname $networkport = new NetworkPort(); - $db_networkport = $networkport->find(["itemtype" => $item->getType(), "items_id" => $item->getID()]); + $db_networkport = $networkport->find(["itemtype" => $item::class, "items_id" => $item->getID()]); foreach (array_keys($db_networkport) as $networkport_id) { $DB->update( "glpi_networknames", @@ -657,7 +657,7 @@ public static function deleteGlpiInventoryLink($item) continue; } - if (in_array($sub_item::class, [Agent::class, Asset_PeripheralAsset::class, Lockedfield::class, NetworkName::class])) { + if (in_array($sub_item::class, [Agent::class, Asset_PeripheralAsset::class, Lockedfield::class, NetworkName::class], true)) { // Specific handling continue; } @@ -684,7 +684,7 @@ public static function deleteGlpiInventoryLink($item) ], [ $items_id_field => $item->getID(), - $itemtype_field => $item->getType(), + $itemtype_field => $item::class, 'is_dynamic' => 1, ], ); @@ -1089,7 +1089,7 @@ public function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) global $UNINSTALL_TYPES; if ( - self::canView() && in_array($item->getType(), $UNINSTALL_TYPES) && !$withtemplate + self::canView() && in_array($item::class, $UNINSTALL_TYPES) && !$withtemplate ) { return __s('Lifecycle', 'uninstall'); } @@ -1105,7 +1105,7 @@ public static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $ if ( ($item instanceof CommonDBTM) - && in_array($item->getType(), $UNINSTALL_TYPES) + && in_array($item::class, $UNINSTALL_TYPES) ) { self::showFormUninstallation($item->getField('id'), $item, Session::getLoginUserID()); } diff --git a/setup.php b/setup.php index 4d99e21..3d618ca 100644 --- a/setup.php +++ b/setup.php @@ -33,8 +33,8 @@ use function Safe\define; define('PLUGIN_UNINSTALL_VERSION', '2.10.4'); -define("PLUGIN_UNINSTALL_MIN_GLPI", "11.0.0"); -define("PLUGIN_UNINSTALL_MAX_GLPI", "11.0.99"); +define("PLUGIN_UNINSTALL_MIN_GLPI", "12.0.0"); +define("PLUGIN_UNINSTALL_MAX_GLPI", "12.0.99"); /** * Function Init @@ -94,10 +94,10 @@ function plugin_init_uninstall() ], ]; - if (Session::haveRight('uninstall:profile', READ)) { + if (Session::haveRight(PluginUninstallPreference::$rightname, READ)) { $PLUGIN_HOOKS[Hooks::USE_MASSIVE_ACTION]['uninstall'] = true; - if (Session::haveRight('uninstall:profile', UPDATE)) { + if (Session::haveRight(PluginUninstallPreference::$rightname, UPDATE)) { // Add link in GLPI plugins list : $PLUGIN_HOOKS[Hooks::MENU_TOADD]['uninstall'] = ['admin' => PluginUninstallModel::class]; }