-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
242 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
|
||
on: | ||
push: | ||
# Sequence of patterns matched against refs/tags | ||
tags: | ||
- '*.*.*' # Push events to matching ex:20.15.10 | ||
|
||
name: Create release with tag | ||
env: | ||
TAG_VALUE: ${GITHUB_REF/refs\/tags\//} | ||
jobs: | ||
build: | ||
name: Upload Release Asset | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: 7.4 | ||
- name: Build project # This would actually build your project, using zip for an example artifact | ||
id: build_ | ||
env: | ||
GITHUB_NAME: ${{ github.event.repository.name }} | ||
|
||
|
||
run: php -v ;sudo apt-get install libxml-xpath-perl; sudo apt-get install composer;echo $(xpath -e '/root/versions/version[num="'${GITHUB_REF/refs\/tags\//}'"]/compatibility/text()' $GITHUB_NAME.xml);echo ::set-output name=version_glpi::$(xpath -e '/root/versions/version[num="'${GITHUB_REF/refs\/tags\//}'"]/compatibility/text()' $GITHUB_NAME.xml); [[ -f composer.json ]] && composer install --no-dev; rm -rf $GITHUB_NAME.xml tools wiki screenshots test .git .github ISSUE_TEMPLATE.md TODO.txt $GITHUB_NAME.png;cd ..; tar -jcvf glpi-$GITHUB_NAME-${GITHUB_REF/refs\/tags\//}.tar.bz2 $GITHUB_NAME;ls -al;echo ::set-output name=tag::${GITHUB_REF/refs\/tags\//};echo ${{ steps.getxml.outputs.info }}; | ||
# run: rm -rf $GITHUB_NAME.xml tools wiki screenshots test ISSUE_TEMPLATE.md TODO.txt $GITHUB_NAME.png; tar -zcvf glpi-$GITHUB_NAME-$GITHUB_TAG.tar.bz2 $GITHUB_NAME | ||
- name: Create Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: | | ||
GLPI ${{ steps.build_.outputs.version_glpi }} : Version ${{ github.ref }} disponible / available | ||
body : Version ${{ steps.build_.outputs.tag }} released for GLPI ${{ steps.build_.outputs.version_glpi }} | ||
draft: false | ||
prerelease: true | ||
- name: Upload Release Asset | ||
id: upload-release-asset | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
GITHUB_NAME: ${{ github.event.repository.name }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps | ||
asset_path: /home/runner/work/${{ github.event.repository.name }}/glpi-${{ github.event.repository.name }}-${{ steps.build_.outputs.tag }}.tar.bz2 | ||
asset_name: glpi-${{ github.event.repository.name }}-${{ steps.build_.outputs.tag }}.tar.bz2 | ||
asset_content_type: application/zip | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"minimum-stability": "dev", | ||
"prefer-stable": true, | ||
"require-dev": { | ||
"glpi-project/tools": "^0.4" | ||
}, | ||
"require": { | ||
"apereo/phpcas": "^1.6" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
/** | ||
* ------------------------------------------------------------------------- | ||
* phpcas plugin for GLPI | ||
* ------------------------------------------------------------------------- | ||
* | ||
* LICENSE | ||
* | ||
* This file is part of phpcas. | ||
* | ||
* phpcas is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* any later version. | ||
* | ||
* phpcas is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with phpcas. If not, see <http://www.gnu.org/licenses/>. | ||
* ------------------------------------------------------------------------- | ||
* @copyright Copyright (C) 2013-2022 by phpcas plugin team. | ||
* @license GPLv2 https://www.gnu.org/licenses/gpl-2.0.html | ||
* @link https://github.com/infotelglpi/phpcas | ||
* ------------------------------------------------------------------------- | ||
*/ | ||
|
||
function plugin_phpcas_install() { | ||
return true; | ||
} | ||
|
||
/** | ||
* Plugin uninstall process | ||
* | ||
* @return boolean | ||
*/ | ||
function plugin_phpcas_uninstall() { | ||
return true; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<root> | ||
<name>phpcas</name> | ||
<key>phpcas</key> | ||
<state>stable</state> | ||
<logo></logo> | ||
<description> | ||
<short> | ||
<en>phpcas GLPI plugin.</en> | ||
<fr>Plugin GLPI phpcas</fr> | ||
</short> | ||
<long> | ||
<en>Add phpcas library</en> | ||
<fr>Ajoute la librairie php-cas</fr> | ||
</long> | ||
</description> | ||
<homepage>https://github.com/infotelGLPI/phpcas</homepage> | ||
<download>https://github.com/infotelGLPI/phpcas/releases</download> | ||
<issues>https://github.com/infotelGLPI/phpcas/issues</issues> | ||
<readme>https://github.com/infotelGLPI/phpcas/blob/master/README.md</readme> | ||
<authors> | ||
<author>Teclib'</author> | ||
</authors> | ||
<versions> | ||
<version> | ||
<num>1.0.0</num> | ||
<compatibility>^10.0.10</compatibility> | ||
<download_url>https://github.com/InfotelGLPI/phpcas/releases/download/1.0.0/glpi-phpcas-1.0.0.tar.bz2</download_url> | ||
</version> | ||
</versions> | ||
<langs> | ||
<lang>en_GB</lang> | ||
<lang>fr_FR</lang> | ||
</langs> | ||
<license>GPL-2.0-or-later</license> | ||
<tags> | ||
<en> | ||
<tag>CAS</tag> | ||
<tag>Authentication</tag> | ||
</en> | ||
<fr> | ||
<tag>CAS</tag> | ||
<tag>Authentification</tag> | ||
</fr> | ||
</tags> | ||
<screenshots> | ||
</screenshots> | ||
</root> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
<?php | ||
|
||
/** | ||
* ------------------------------------------------------------------------- | ||
* phpcas plugin for GLPI | ||
* ------------------------------------------------------------------------- | ||
* | ||
* LICENSE | ||
* | ||
* This file is part of phpcas. | ||
* | ||
* phpcas is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* any later version. | ||
* | ||
* phpcas is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with phpcas. If not, see <http://www.gnu.org/licenses/>. | ||
* ------------------------------------------------------------------------- | ||
* @copyright Copyright (C) 2013-2022 by phpcas plugin team. | ||
* @license GPLv2 https://www.gnu.org/licenses/gpl-2.0.html | ||
* @link https://github.com/infotelglpi/phpcas | ||
* ------------------------------------------------------------------------- | ||
*/ | ||
|
||
define('PLUGIN_PHPCAS_VERSION', '1.0.0'); | ||
|
||
// Minimal GLPI version, inclusive | ||
define("PLUGIN_PHPCAS_MIN_GLPI_VERSION", "10.0.1"); | ||
// Maximum GLPI version, exclusive | ||
define("PLUGIN_PHPCAS_MAX_GLPI_VERSION", "10.0.99"); | ||
|
||
define('PLUGIN_PHPCAS_ROOT', Plugin::getPhpDir('phpcas')); | ||
/** | ||
* Init hooks of the plugin. | ||
* REQUIRED | ||
* | ||
* @return void | ||
*/ | ||
function plugin_init_phpcas() | ||
{ | ||
global $PLUGIN_HOOKS; | ||
|
||
$PLUGIN_HOOKS['csrf_compliant']['phpcas'] = true; | ||
|
||
if (!Plugin::isPluginActive('phpcas')) { | ||
return false; | ||
} | ||
|
||
include_once(PLUGIN_PHPCAS_ROOT . "/vendor/autoload.php"); | ||
} | ||
|
||
|
||
/** | ||
* Get the name and the version of the plugin | ||
* REQUIRED | ||
* | ||
* @return array | ||
*/ | ||
function plugin_version_phpcas() | ||
{ | ||
return [ | ||
'name' => 'phpcas', | ||
'version' => PLUGIN_PHPCAS_VERSION, | ||
'author' => "<a href='https://blogglpi.infotel.com'>Infotel</a>, Xavier Caillaud", | ||
'license' => 'GPL-2.0-or-later', | ||
'homepage' => '', | ||
'requirements' => [ | ||
'glpi' => [ | ||
'min' => PLUGIN_PHPCAS_MIN_GLPI_VERSION, | ||
'max' => PLUGIN_PHPCAS_MAX_GLPI_VERSION, | ||
] | ||
] | ||
]; | ||
} | ||
|
||
function plugin_phpcas_check_prerequisites() | ||
{ | ||
if (!is_readable(__DIR__ . '/vendor/autoload.php') || !is_file(__DIR__ . '/vendor/autoload.php')) { | ||
echo "Run composer install --no-dev in the plugin directory<br>"; | ||
return false; | ||
} | ||
|
||
return true; | ||
} |