Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(sccm): Works with multiple configurations #120

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 16 additions & 13 deletions front/config.form.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,31 +32,34 @@
include ('../../../inc/includes.php');
require_once('../inc/config.class.php');


Session::checkRight("config", UPDATE);

$PluginSccmConfig = new PluginSccmConfig();


if (isset($_POST["update"])) {
if (array_key_exists('sccmdb_password', $_POST)) {
// Password must not be altered.
$_POST['sccmdb_password'] = $_UPOST['sccmdb_password'];
}

$PluginSccmConfig->update($_POST);

$sccmDB = new PluginSccmSccmdb();
if ($sccmDB->connect()) {
Session::addMessageAfterRedirect("Connexion réussie !.", false, INFO, false);
} else {
Session::addMessageAfterRedirect("Connexion incorrecte.", false, ERROR, false);
//test connection
$sccmDB = new PluginSccmSccmdb();
$sccmDB->testConfiguration($_POST['id']);
Html::back();
} else if (isset($_POST["add"])) {
if ($PluginSccmConfig->add($_POST)) {
if ($_SESSION['glpibackcreated']) {
Html::redirect($track->getLinkURL());
}
}


Html::back();
} else if (isset($_POST["purge"])) {
$PluginSccmConfig->delete($_POST, 1);
$PluginSccmConfig->redirectToList();
}

Html::header(__("Setup - SCCM", "sccm"), $_SERVER["PHP_SELF"],
"plugins", "sccm", "configuration");
$PluginSccmConfig->showConfigForm($PluginSccmConfig);
Html::footer();
Html::header(PluginSccmConfig::getTypeName(), $_SERVER["PHP_SELF"], "config", PluginSccmMenu::class, "configuration");
$PluginSccmConfig->display($_GET);
Html::footer();
36 changes: 36 additions & 0 deletions front/config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

/**
* -------------------------------------------------------------------------
* SCCM plugin for GLPI
* -------------------------------------------------------------------------
*
* LICENSE
*
* This file is part of SCCM.
*
* SCCM 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.
*
* SCCM 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 SCCM. If not, see <http://www.gnu.org/licenses/>.
* -------------------------------------------------------------------------
* @author François Legastelois
* @copyright Copyright (C) 2014-2023 by SCCM plugin team.
* @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html
* @link https://github.com/pluginsGLPI/sccm
* -------------------------------------------------------------------------
*/

include ('../../../inc/includes.php');

Html::header(PluginSccmConfig::getTypeName(), $_SERVER["PHP_SELF"], "config", PluginSccmMenu::class, "configuration");
Search::show('PluginSccmConfig');
Html::footer();
12 changes: 6 additions & 6 deletions front/test.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
function viewList() {
global $PluginSccmSccm;

$PluginSccmSccm->getDevices();
$PluginSccmSccm->getDevices("");

echo "<table class='tab_glpi'>";
foreach ($PluginSccmSccm->devices as $device_values) {
Expand All @@ -106,7 +106,7 @@ function viewList() {
function nbPcToInject() {
global $PluginSccmSccm;

$PluginSccmSccm->getDevices();
$PluginSccmSccm->getDevices("");

echo count($PluginSccmSccm->devices);
}
Expand All @@ -117,7 +117,7 @@ function testViewHtml($limit, $where) {
$PluginSccmSccm->getDevices($where);

foreach ($PluginSccmSccm->devices as $device_values) {
$PluginSccmSccmxml = new PluginSccmSccmxml($device_values);
$PluginSccmSccmxml = new PluginSccmSccmxml($PluginSccmSccm, $device_values);

$PluginSccmSccmxml->setAccessLog();
$PluginSccmSccmxml->setAccountInfos();
Expand All @@ -128,7 +128,7 @@ function testViewHtml($limit, $where) {
$PluginSccmSccmxml->setSoftwares();
$PluginSccmSccmxml->setUsers();
$PluginSccmSccmxml->setNetworks();
$PluginSccmSccmxml->setDrives();
$PluginSccmSccmxml->setStorages();

$SXML = $PluginSccmSccmxml->sxml;

Expand All @@ -144,7 +144,7 @@ function testAdd($where) {
$REP_XML = GLPI_PLUGIN_DOC_DIR.'/sccm/xml/';

foreach ($PluginSccmSccm->devices as $device_values) {
$PluginSccmSccmxml = new PluginSccmSccmxml($device_values);
$PluginSccmSccmxml = new PluginSccmSccmxml($PluginSccmSccm, $device_values);

$PluginSccmSccmxml->setAccessLog();
$PluginSccmSccmxml->setAccountInfos();
Expand All @@ -155,7 +155,7 @@ function testAdd($where) {
$PluginSccmSccmxml->setSoftwares();
$PluginSccmSccmxml->setUsers();
$PluginSccmSccmxml->setNetworks();
$PluginSccmSccmxml->setDrives();
$PluginSccmSccmxml->setStorages();

$SXML = $PluginSccmSccmxml->sxml;

Expand Down
Loading