Skip to content

Commit bc2e619

Browse files
committed
Prepare GLPI 12
1 parent 7e253d3 commit bc2e619

19 files changed

Lines changed: 55 additions & 42 deletions

‎.gitattributes‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Always LF, in the repository and in the working tree (CI and release tools run on Linux)
2+
* text=auto eol=lf

‎.github/workflows/continuous-integration.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
name: "Generate CI matrix"
2121
uses: "glpi-project/plugin-ci-workflows/.github/workflows/generate-ci-matrix.yml@v1"
2222
with:
23-
glpi-version: "11.0.x"
23+
glpi-version: "12.0.x"
2424
ci:
2525
name: "GLPI ${{ matrix.glpi-version }} - php:${{ matrix.php-version }} - ${{ matrix.db-image }}"
2626
needs: "generate-ci-matrix"

‎.github/workflows/phpunit.yml‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
uses: actions/checkout@v7
2626
with:
2727
repository: glpi-project/glpi
28-
ref: 11.0/bugfixes
28+
ref: 12.0/bugfixes
2929
path: glpi
3030

3131
- name: Checkout plugin
@@ -91,7 +91,7 @@ jobs:
9191
uses: actions/checkout@v7
9292
with:
9393
repository: glpi-project/glpi
94-
ref: 11.0/bugfixes
94+
ref: 12.0/bugfixes
9595
path: glpi
9696

9797
- name: Checkout plugin
@@ -117,6 +117,12 @@ jobs:
117117
run: composer install --no-interaction --prefer-dist --no-progress
118118
working-directory: glpi
119119

120+
# GLPI 12 requires node >= 24.11 (package.json "engines"); ubuntu-latest ships node 22
121+
- name: Setup Node.js
122+
uses: actions/setup-node@v7
123+
with:
124+
node-version: "24"
125+
120126
- name: Build GLPI frontend dependencies
121127
run: |
122128
npm install --no-save
@@ -142,8 +148,8 @@ jobs:
142148

143149
- name: Install vip plugin
144150
run: |
145-
php bin/console glpi:plugin:install --no-interaction --env=testing vip
146-
php bin/console glpi:plugin:activate --no-interaction --env=testing vip
151+
php bin/console plugin:install --no-interaction --env=testing vip
152+
php bin/console plugin:activate --no-interaction --env=testing vip
147153
working-directory: glpi
148154

149155
- name: Run integration tests

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
.php-cs-fixer.cache
33
.phpunit.result.cache
44
/.phpunit.cache/
5+
composer.lock

‎ajax/loadscripts.php‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,10 @@
2828
*/
2929

3030
use GlpiPlugin\Vip\Group;
31+
use GlpiPlugin\Vip\Vip;
3132

3233
Html::header_nocache();
33-
Session::checkRight('plugin_vip', READ);
34+
Session::checkRight(Vip::$rightname, READ);
3435
header("Content-Type: application/json; charset=UTF-8");
3536

3637
global $CFG_GLPI;

‎ajax/ticket.php‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@
2828
*/
2929

3030
use GlpiPlugin\Vip\Ticket;
31+
use GlpiPlugin\Vip\Vip;
3132

32-
Session::checkRight('plugin_vip', READ);
33+
Session::checkRight(Vip::$rightname, READ);
3334

3435
$action = $_POST['action'] ?? '';
3536
switch ($action) {

‎composer.json‎

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@
33
"php": ">=8.2"
44
},
55
"require-dev": {
6-
"friendsofphp/php-cs-fixer": "^3.95",
7-
"glpi-project/tools": "^0.8",
8-
"php-parallel-lint/php-parallel-lint": "^1.4",
9-
"glpi-project/phpstan-glpi": "^1.3",
10-
"phpunit/phpunit": "^11.5"
6+
"glpi-project/tools": "^0.8"
117
},
128
"config": {
139
"autoloader-suffix": "PluginVip",
@@ -18,10 +14,10 @@
1814
"sort-packages": true
1915
},
2016
"scripts": {
21-
"lint": "parallel-lint --exclude vendor --exclude node_modules .",
22-
"cs": "php-cs-fixer fix --dry-run --diff --ansi",
23-
"cs-fix": "php-cs-fixer fix --ansi",
24-
"phpstan": "phpstan analyze --ansi --memory-limit=1G",
17+
"lint": "../../vendor/bin/parallel-lint --exclude vendor --exclude node_modules .",
18+
"cs": "../../vendor/bin/php-cs-fixer fix --dry-run --diff --ansi",
19+
"cs-fix": "../../vendor/bin/php-cs-fixer fix --ansi",
20+
"phpstan": "../../vendor/bin/phpstan analyze --ansi --memory-limit=1G",
2521
"qa": [
2622
"@lint",
2723
"@phpstan",

‎front/group.form.php‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@
2929

3030
use Glpi\Exception\Http\AccessDeniedHttpException;
3131
use GlpiPlugin\Vip\Group;
32+
use GlpiPlugin\Vip\Vip;
3233

33-
Session::checkRight("plugin_vip", UPDATE);
34+
Session::checkRight(Vip::$rightname, UPDATE);
3435

3536
$grp = new Group();
3637

‎hook.php‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
use GlpiPlugin\Vip\Profile;
3333
use GlpiPlugin\Vip\RuleVip;
3434
use GlpiPlugin\Vip\Ticket;
35+
use GlpiPlugin\Vip\Vip;
3536

3637
function plugin_vip_install()
3738
{
@@ -97,7 +98,7 @@ function plugin_vip_getAddSearchOptions($itemtype)
9798
$sopt = [];
9899

99100
if (Session::getCurrentInterface() == 'central'
100-
&& Session::haveRight('plugin_vip', READ)) {
101+
&& Session::haveRight(Vip::$rightname, READ)) {
101102
switch ($itemtype) {
102103
case 'Ticket':
103104
case 'Computer':
@@ -264,7 +265,7 @@ function plugin_vip_executeActions($options)
264265

265266
function plugin_vip_redefine_api_schemas(array $data): array
266267
{
267-
if (!Session::haveRight('plugin_vip', READ)) {
268+
if (!Session::haveRight(Vip::$rightname, READ)) {
268269
return $data;
269270
}
270271
foreach ($data['schemas'] as &$schema) {

‎setup.php‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,17 @@ function plugin_init_vip()
5454
Plugin::registerClass(Profile::class, ['addtabon' => ['Profile']]);
5555
$PLUGIN_HOOKS[Hooks::CHANGE_PROFILE]['vip'] = [Profile::class, 'changeProfile'];
5656

57-
if (Session::haveRight('plugin_vip', UPDATE)) {
57+
if (Session::haveRight(Vip::$rightname, UPDATE)) {
5858
Plugin::registerClass(Group::class, ['addtabon' => ['Group']]);
5959
$PLUGIN_HOOKS[Hooks::USE_MASSIVE_ACTION]['vip'] = 1;
6060
Plugin::registerClass(Ticket::class);
6161
}
6262

63-
if (class_exists('PluginMydashboardMenu') && Session::haveRight('plugin_vip', READ)) {
63+
if (class_exists('PluginMydashboardMenu') && Session::haveRight(Vip::$rightname, READ)) {
6464
$PLUGIN_HOOKS['mydashboard']['vip'] = [Dashboard::class];
6565
}
6666

67-
if (Session::haveRight('plugin_vip', READ)
67+
if (Session::haveRight(Vip::$rightname, READ)
6868
&& isset($_SESSION["glpiactiveprofile"]["interface"])
6969
&& $_SESSION["glpiactiveprofile"]["interface"] != "helpdesk") {
7070
$PLUGIN_HOOKS[Hooks::ADD_JAVASCRIPT]['vip'][] = 'js/vip.js';
@@ -77,7 +77,7 @@ function plugin_init_vip()
7777
}
7878
}
7979
}
80-
if (Session::haveRight('plugin_vip', READ)
80+
if (Session::haveRight(Vip::$rightname, READ)
8181
&& isset($_SESSION["glpiactiveprofile"]["interface"])
8282
&& $_SESSION["glpiactiveprofile"]["interface"] != "helpdesk") {
8383
$PLUGIN_HOOKS['pre_show_item']['vip'] = [Ticket::class, 'showVIPInfos'];
@@ -104,8 +104,8 @@ function plugin_version_vip()
104104
'homepage' => 'https://github.com/pluginsGLPI/vip',
105105
'requirements' => [
106106
'glpi' => [
107-
'min' => '11.0',
108-
'max' => '12.0',
107+
'min' => '11.0.99',
108+
'max' => '12.0.99',
109109
'dev' => false,
110110
],
111111
],

0 commit comments

Comments
 (0)