$accessgroup = $accessGroupController->addAccessGroup($accessgroupName); //add new access rules foreach ($newAccessRights as $newAccessRight) { $accessGroupController->addAccessRule($accessgroupName, $newAccessRight[0], $newAccessRight[1]); } } catch (CmdbAccessRuleAlreadyExistsException $e3) { printErrorMessage(sprintf(gettext("Error setting access rights for group %s. Because of dupplicate entries"), $accessgroupName)); } catch (Exception $e2) { printErrorMessage(sprintf(gettext("Error setting access rights for access group %s"), $accessgroupName)); } } catch (CmdbAccessRuleAlreadyExistsException $e3) { printErrorMessage(sprintf(gettext("Error updating access rights for access group %s. Because of dupplicate entries"), $accessgroupName)); } break; case "deleteGroup": $accessgroupName = getHttpGetVar("name", ""); try { $accessGroupController->deleteAccessGroup($accessgroupName); printInfoMessage(sprintf(gettext("access group %s successfully deleted"), $accessgroupName)); } catch (CmdbAccessGroupNotFoundException $e) { printErrorMessage(sprintf(gettext("Error deleting access group %s"), $accessgroupName)); } break; } //get data $accessgroups = $accessGroupController->getAccessgroups(); //output: navigation echo "<div>"; echo "<p>"; echo "<a href=\"#\" data-toggle=\"modal\" data-target=\"#editAccessGroup\" data-dynform=\"admin/Authorisation.php?action=editGroupForm&name=\">"; echo "<span class=\"glyphicon glyphicon-plus\"></span>";
*/ //include base functions include "../include/bootstrap-web.php"; include "../include/auth.inc.php"; //central objects: $authProvider $functionalityPasswordChange = false; if (method_exists($authProvider, "resetPassword")) { $functionalityPasswordChange = true; } //execute actions if required $action = getHttpGetVar("action", ""); switch ($action) { case "changePassword": $oldPassword = getHttpGetVar("oldPassword", ""); $newPassword = getHttpGetVar("newPassword", ""); $newPassword2 = getHttpGetVar("newPassword2", ""); //check, if AuthenticationProvider allows password changeing if (!$functionalityPasswordChange) { printErrorMessage(gettext("Password changeing is not allowed.")); break; } //check if oldPassword is correct $result = $authProvider->authenticate($authUser, $oldPassword); if (!$result) { printErrorMessage(gettext("Password not changed. Your old password was not correct.")); break; } //check new passwords and set the new passwordonly change password if field is not empty if ($newPassword != "" && $newPassword == $newPassword2) { $result = $authProvider->resetPassword($authUser, $newPassword); if ($result) {
* 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 yourCMDB. If not, see <http://www.gnu.org/licenses/>. * *********************************************************************/ /** * yourCMDB navigation * @author Michael Batz <*****@*****.**> */ //get data $menuitems = $config->getViewConfig()->getMenuItems(); $objectGroups = $config->getObjectTypeConfig()->getObjectTypeGroups(); $quicksearchString = getHttpGetVar("searchstring", ""); //navbar header echo "<nav class=\"navbar cmdb-navigation\">"; //mobile view echo "<div class=\"navbar-header\">"; echo "<button type=\"button\" class=\"navbar-toggle collapsed\" data-toggle=\"collapse\" data-target=\"#cmdb-navigation-collapse\">"; echo "<span class=\"sr-only\">Toggle navigation</span>"; echo "<span class=\"icon-bar\"></span>"; echo "<span class=\"icon-bar\"></span>"; echo "<span class=\"icon-bar\"></span>"; echo "</button>"; //title echo "<h1><a href=\"index.php\"><img src=\"img/logo_small.png\" alt=\"yourCMDB\" />"; echo "{$installTitle}</a></h1>"; echo "</div>"; //quicksearch
* yourCMDB 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. * * yourCMDB 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 yourCMDB. If not, see <http://www.gnu.org/licenses/>. * *********************************************************************/ /** * WebUI element: export data * @author Michael Batz <*****@*****.**> */ //load WebUI base require "include/bootstrap-web.php"; require "include/auth.inc.php"; //get parameter $paramType = getHttpGetVar("type", ""); $paramFormat = getHttpGetVar("format", "csv"); //get data $objects = $objectController->getObjectsByType(array($paramType), null, "ASC", null, 0, 0, $authUser); switch ($paramFormat) { case "csv": include "export/ExportCsv.php"; break; }
* This file is part of yourCMDB. * * Copyright 2013-2015 Michael Batz * * * yourCMDB 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. * * yourCMDB 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 yourCMDB. If not, see <http://www.gnu.org/licenses/>. * *********************************************************************/ /** * WebUI helper: short links * @author Michael Batz <*****@*****.**> */ //load WebUI base require "include/bootstrap-web.php"; //get parameters $paramId = getHttpGetVar("id", ""); //get baseUrl from config $baseUrl = $config->getViewConfig()->getBaseUrl(); //redirect to show object page header("Location: {$baseUrl}/object.php?action=show&id={$paramId}");
*********************************************************************/ /** * yourDashboard AJAX Loader * loads content parts for the dashboard * for usage in ajax functions * @author: Michael Batz <*****@*****.**> */ //load base functions and header require "include/bootstrap-web.php"; //check, which content should be loaded $content = getHttpGetVar("content", ""); switch ($content) { case "dashlet": $dashboard = $controller->getDashboardObject(getHttpGetVar("dashboard", "default")); $dashletRow = getHttpGetVar("row", 0); $dashletId = getHttpGetVar("id", 0); loadDashlet($dashboard, $dashletRow, $dashletId); break; default: break; } /** * Loads and prints out the content of a specific dashlet * @param $dashboard Dashboard object * @param $dashletRow Row of the dashlet * @param $dashletId Id of the dashlet */ function loadDashlet($dashboard, $dashletRow, $dashletId) { try { //print dashlet content
use yourCMDB\exceptions\CmdbObjectLinkNotFoundException; use Exception; //get UI Helper include "object/ObjectUiHelper.php"; //get parameters $paramId = getHttpGetVar("id", 0); $paramIdB = getHttpGetVar("idb", 0); $paramAction = getHttpGetVar("action", "show"); $paramEvent = getHttpGetVar("event", ""); $paramType = getHttpGetVar("type", ""); $paramMessage = ""; $paramMax = getHttpGetVar("max", $config->getViewConfig()->getContentTableLength()); $paramPage = getHttpGetVar("page", "1"); $paramSort = getHttpGetVar("sort", ""); $paramSortType = getHttpGetVar("sorttype", "ASC"); $paramStatus = getHttpGetVar("status", "A"); if ($paramStatus != "A") { $paramStatus = "0"; } if ($paramSortType != "ASC") { $paramSortType = "DESC"; } switch ($paramAction) { case "list": include "object/ListObjects.php"; break; case "show": //get object and object links try { $object = $objectController->getObject($paramId, $authUser); } catch (CmdbObjectNotFoundException $e) {
* You should have received a copy of the GNU General Public License * along with yourCMDB. If not, see <http://www.gnu.org/licenses/>. * *********************************************************************/ /** * WebUI helper: autocomplete * @author Michael Batz <*****@*****.**> */ //include functions include "include/bootstrap-web.php"; include "include/auth.inc.php"; //get parameters $paramSearchstring = getHttpGetVar("term", ""); $paramObject = getHttpGetVar("object", ""); $paramVar1 = getHttpGetVar("var1", ""); $paramVar2 = getHttpGetVar("var2", ""); $values = array(); //get data and create output $output = array(); switch ($paramObject) { //var1 : fieldkey case "object": $values = $objectController->getAllFieldValues(null, $paramVar1, $paramSearchstring, 10, "yourCMDB-API"); foreach ($values as $value) { $output[] = $value; } break; case "assetids": $values = $objectController->getAllObjectIds($paramSearchstring, 10, "yourCMDB-API"); foreach ($values as $value) { $output[] = array("data" => $value, "value" => $value);
break; case "deleteUser": $username = getHttpGetVar("username", ""); if ($username != $authUser) { try { $result = $authProviderLocal->deleteUser($username); printInfoMessage(sprintf(gettext("user %s successfully deleted"), $username)); } catch (CmdbLocalUserNotFoundException $e) { printErrorMessage(sprintf(gettext("Error deleting user %s. User not found."), $username)); } } break; case "editUser": $username = getHttpGetVar("username", ""); $password = getHttpGetVar("password", ""); $accessgroup = getHttpGetVar("accessgroup", ""); $message = ""; //only change password if field is not empty try { if ($password != "") { $result = $authProviderLocal->resetPassword($username, $password); if ($result) { $message .= gettext("Password successfully changed. "); } } //only change accessgroup if field is not empty if ($accessgroup != "") { $result = $authProviderLocal->setAccessGroup($username, $accessgroup); if ($result) { $message .= gettext("Accessgroup successfully changed. "); }
* 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 yourDashboard. If not, see <http://www.gnu.org/licenses/>. * *********************************************************************/ /** * yourDashboard main page * @author: Michael Batz <*****@*****.**> */ //load base functions and header require "include/bootstrap-web.php"; //get dashboard name $dashboardName = getHttpGetVar("dashboard", "default"); $errorMessage = ""; //open dashboard try { $dashboard = $controller->getDashboardObject($dashboardName); } catch (Exception $e) { $errorMessage = $e->getMessage(); } $dashboardConfig = $controller->getConfig()->getDashboardConfig(); $customizingConfig = $controller->getConfig()->getCustomizingConfig(); $alarmConfig = $controller->getConfig()->getAlarmConfig(); //render dashboard require "include/header.inc.php"; if (isset($dashboard)) { $dashboard->render(); } else {
* 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 yourCMDB. If not, see <http://www.gnu.org/licenses/>. * *********************************************************************/ /** * yourCMDB WebUI: login page * @author: Michael Batz <*****@*****.**> */ //get header include "include/bootstrap-web.php"; include "include/htmlheader.inc.php"; $loginError = getHttpGetVar("error", "false"); //container echo "<div id=\"cmdb-logincontainer\">"; echo "<div class=\"container\">"; echo "<div class=\"row\">"; echo "<div class=\"col-md-6 col-md-offset-3\">"; //login panel echo "<div class=\"panel\" id=\"cmdb-loginpanel\">"; //login panel headline echo "<div class=\"panel-heading\">" . gettext("Welcome to yourCMDB!") . "</div>"; //login panel body echo "<div class=\"panel-body\">"; echo "<form method=\"post\" action=\"index.php\" class=\"form-horizontal\">"; //login form if ($loginError != "false") { printErrorMessage(gettext("Sorry, wrong username or password. Please try again..."));
if ($paramSearchbarString != "") { $searchbarInterpreter = new SearchbarInterpreter($paramSearchbarString); $searchFilter = $searchbarInterpreter->returnSearchFilter(); $searchbarInterpretedObject = $searchbarInterpreter->returnInterpretedObject(); } else { $paramFilter = getHttpGetVar("filter", array()); $searchFilter = new SearchFilter(); foreach ($paramFilter as $filterEntry) { $searchFilter->addFilter($filterEntry); } } //get objects $objects = $searchFilter->getObjects($authUser); //setup pagination $paramMax = getHttpGetVar("max", $config->getViewConfig()->getContentTableLength()); $paramPage = getHttpGetVar("page", "1"); //filter values //filter value text $filterValuesText = $searchFilter->getFilterValues("text"); $filterValueText = ""; if (isset($filterValuesText[0])) { $filterValueText = $filterValuesText[0]; } $filterValueTextArray = array_filter(explode(" ", $filterValueText)); //filter value status $filterValuesStatus = $searchFilter->getFilterValues("status"); $filterValueStatus = ""; if (isset($filterValuesStatus[0])) { $filterValueStatus = $filterValuesStatus[0]; } //filter value object types