Skip to content

Commit

Permalink
Release v1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
FrancisTicgal committed Nov 24, 2022
1 parent af15cd5 commit a511887
Show file tree
Hide file tree
Showing 31 changed files with 3,130 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
dist/
node_modules/
vendor/
.gh_token
composer.lock
*.min.*

47 changes: 47 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Borgbase - GLPI Plugin CHANGELOG

## 1.0.0

## 0.7.1 - 2022-11-23
- Automatic link (#12348)

### Bugfixes
- New KPI overwrite dashboard cards list (#12245)
- Dashboard card returns 0 repositories (#12310)

## 0.6.2 - 2022-11-10
### Features
- Dashboard graphs (#12093)

### Bugfixes
- READ permissions (#12140)
- Fixing other errors (#12145)

## 0.5.0 - 2022-11-08
### Features
- API connection indicator (#12087)
- Confirm buttons (#12090)

## 0.4.2 - 2022-11-07
### Features
- Permissions (#12062)
- Historial (#11970)
- Spanish and Galician translations (#11957)

### Bugfixes
- Changing mysql tables engine to InnoDB (#12027)
- Fixing wrong calculation in unit bytes (#12019)

## 0.3.0 - 2022-10-28
### Features
- Unlink repositories (#11865)
- Dropdowns instead classic inputs (#11880)
- Searcheable dropdown (#11930)

## 0.2.0 - 2022-10-20
### Features
- Automatic actions (#11755)

## 0.1.0 - 2022-10-17
### Features
- MVP (#11626)
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Borgbase GLPI Plugin

Plugin with [Borgbase](https://www.borgbase.com/) integration for GLPI to link devices with their backups.

[![License](https://img.shields.io/badge/License-GNU%20AGPLv3-blue.svg)](https://github.com/ticgal/taskdrop/blob/master/LICENSE)
[![Twitter](https://img.shields.io/badge/Twitter-TICgal-blue.svg)](https://twitter.com/ticgalcom)
[![TICgal](https://img.shields.io/badge/Web-TICgal-blue.svg)](https://tic.gal/)
[![Localazy](https://img.shields.io/badge/Translate-Localazy-cyan)](https://localazy.com/p/one-time-secret-glpi#translations)

## Supported versions
- GLPI 10.0.x

# How to configure it

With the first installation you have to go to GLPI configuration panel (Setup > General > Borgbase) and add the Borgbase API key.

Configure the permissions of the profiles that will manage the plugin:
- UPDATE: The user will be able to update the repository data manually.
- CREATE: The user will be able to create links between computer and repository, if the name does not match.
- PURGE: The user will be able to delete manually created links.

## How to use it

By default, if the computer name exactly matches the repository name in Borgbase, the relevant data is stored and can be reviewed in the tab of the computer itself.

Each computer will have a tab with its own Borgbase repository. It can be linked manually in case they do not match.
57 changes: 57 additions & 0 deletions borgbase.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<root>
<name>Borgbase</name>
<key>borgbase</key>
<!-- stable, beta, development, alpha, ... -->
<state>stable</state>
<logo>https://raw.githubusercontent.com/pluginsGLPI/borgbase/master/{LNAME}.png</logo>
<description>
<short>
<!-- Add as many lang tag you want -->
<en>Borgbase GLPI plugin.</en>
<fr>Plugin GLPI Borgbase</fr>
</short>
<long>
<!-- Add as many lang tag you want -->
<en>A long description for Borgbase GLPI plugin.</en>
<fr>Un description longue pour le plugin GLPI Borgbase</fr>
</long>
</description>
<homepage>https://github.com/pluginsGLPI/borgbase</homepage>
<download>https://github.com/pluginsGLPI/borgbase/releases</download>
<issues>https://github.com/pluginsGLPI/borgbase/issues</issues>
<readme>https://github.com/pluginsGLPI/borgbase/blob/master/README.md</readme>
<authors>
<!-- Add as many author tag you want -->
<author>Teclib'</author>
</authors>
<versions>
<!-- Add as many version tag you want -->
<version>
<num>0.0.1</num>
<!-- Add as many compatibility tag you want -->
<compatibility>9.4</compatibility>
<compatibility>9.3</compatibility>
<compatibility>9.2</compatibility>
</version>
</versions>
<langs>
<!-- Add as many lang tag you want -->
<lang>en_GB</lang>
<lang>fr_FR</lang>
</langs>
<license>GPL V3+</license>
<!--tags>
<en>
<tag>One tag</tag>
<tag>Another tag</tag>
</en>
<fr>
<tag>Un tag</tag>
<tag>Un autre tag</tag>
</fr>
</tags-->
<!--screenshots>
<screenshot>https://github.com/pluginsGLPI/fields/raw/master/screenshot.png</screenshot>
<screenshot>https://github.com/pluginsGLPI/fields/raw/master/screenshot2.png</screenshot>
</screenshots-->
</root>
15 changes: 15 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"require": {
"php": ">=7.4"
},
"require-dev": {
"glpi-project/tools": "^0.4"
},
"config": {
"optimize-autoloader": true,
"platform": {
"php": "7.4.0"
},
"sort-packages": true
}
}
94 changes: 94 additions & 0 deletions front/borgbase.form.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
<?php
/*
-------------------------------------------------------------------------
Borgbase plugin for GLPI
Copyright (C) 2021-2022 by the TICgal Team.
https://www.tic.gal/
-------------------------------------------------------------------------
LICENSE
This file is part of the Borgbase plugin.
Borgbase plugin 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 3 of the License, or
(at your option) any later version.
Borgbase plugin 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 Borgbase. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
@package Borgbase
@author the TICgal team
@copyright Copyright (c) 2021-2022 TICgal team
@license AGPL License 3.0 or (at your option) any later version
http://www.gnu.org/licenses/agpl-3.0-standalone.html
@link https://www.tic.gal/
@since 2021-2022
----------------------------------------------------------------------
*/
include '../../../inc/includes.php';

$plugin = new Plugin();
if (!$plugin->isInstalled('borgbase') || !$plugin->isActivated('borgbase')) {
Html::displayNotFoundError();
}

$borgbase = new PluginBorgbaseBorgbase();

if (isset($_POST['reload'])) {
if (Session::haveRight(PluginBorgbaseBorgbase::$rightname, UPDATE)) {
$computerId = $_POST['computerId'];
$repoId = $_POST['repoId'];
$borgbase->reloadRepo($repoId);
}
Html::back();
} else if (isset($_POST['unlink'])) {
if (Session::haveRight(PluginBorgbaseBorgbase::$rightname, PURGE)) {
$computerId = $_POST['computerId'];
$repoId = $_POST['repoId'];
$unlink = $borgbase->unlinkRepo($computerId, $repoId);
if ($unlink) {
$changes[0] = $computerId;
$changes[1] = sprintf(__('%2$s, by user %1$s'), $_SESSION["glpiname"], $repoId);
$changes[2] = "";

Log::history(
$computerId,
'Computer',
$changes,
'PluginBorgbaseBorgbase',
LOG::HISTORY_DEL_RELATION
);
}
}
Html::back();
}

if (isset($_POST['assoc']) && Session::haveRight(PluginBorgbaseBorgbase::$rightname, CREATE)) {
$computerId = isset($_POST['id']) ? intval($_POST['id']) : -1;
$repoId = $_POST['repoId'];

if ($computerId === -1) {
Html::back();
}

$repo = $borgbase->getRepo($repoId);
$linked = $borgbase->linkRepo($repo, $computerId);
if ($linked) {
$changes[0] = $computerId;
$changes[1] = "";
$changes[2] = sprintf(__('%2$s, by user %1$s'), $_SESSION["glpiname"], $repoId);

Log::history(
$computerId,
'Computer',
$changes,
'PluginBorgbaseBorgbase',
LOG::HISTORY_ADD_RELATION
);
}
Html::back();
}

Html::back();
62 changes: 62 additions & 0 deletions front/config.form.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?php
/*
-------------------------------------------------------------------------
Borgbase plugin for GLPI
Copyright (C) 2021-2022 by the TICgal Team.
https://www.tic.gal/
-------------------------------------------------------------------------
LICENSE
This file is part of the Borgbase plugin.
Borgbase plugin 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 3 of the License, or
(at your option) any later version.
Borgbase plugin 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 Borgbase. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
@package Borgbase
@author the TICgal team
@copyright Copyright (c) 2021-2022 TICgal team
@license AGPL License 3.0 or (at your option) any later version
http://www.gnu.org/licenses/agpl-3.0-standalone.html
@link https://www.tic.gal/
@since 2021-2022
----------------------------------------------------------------------
*/
include "../../../inc/includes.php";

$plugin = new Plugin();
if (!$plugin->isInstalled('borgbase') || !$plugin->isActivated('borgbase')) {
Html::displayNotFoundError();
}

$borgbase = new PluginBorgbaseConfig;

Session::checkRight('config', UPDATE);
if(isset($_POST['reload'])){
$borgbase->linkAvailableRepos();
}

if (isset($_POST['update'])) {
$borgbase->check($_POST['id'], UPDATE);
$glpikey = new GLPIKey;
if ($_POST['apikey']) {
$_POST["apikey"] = $glpikey->encrypt($_POST["apikey"]);
} else {
unset($_POST['apikey']);
}
$borgbase->update($_POST);

// Checking again, apikey needs to be updated
if($_POST['apikey']){
$borgbase->linkAvailableRepos();
}

Html::back();
}

Html::redirect($CFG_GLPI["root_doc"] . "/front/config.form.php?forcetab=" . urlencode('PluginBorgbaseConfig$1'));
Loading

0 comments on commit a511887

Please sign in to comment.