From 5ccfb9555aa2f9aca5c27add42b8499fb7104566 Mon Sep 17 00:00:00 2001 From: Arjen van Bochoven Date: Thu, 13 Feb 2020 20:57:30 +0100 Subject: [PATCH] Wip (#1316) * Release version 5.1.4. * Bumping to v5.1.5 for development. * Update .htaccess allow .py files to be downloaded * Update locales * Update CHANGELOG * Add remark about migration * Release version 5.1.5. * Bumping to v5.1.6 for development. * Hide the empty blank "Group 0" machine group (#1130) * Hide the empty blank "Group 0" machine group * Changed hiding Group 0 to Unassigned * Updated phpdotenv to version 4.x * Updated phpdotenv to version 4.x * Bump minor version * Enable multiple widgets Override widget name by specifying widget: name in the widget variables * Catch missing LDAP * Saml fix (#1315) * Replace commas with _ in SAML groups * Pass group array by reference * Update CHANGELOG Co-authored-by: tuxudo --- CHANGELOG.md | 31 ++++++++++++++++++++++++++++++- app/controllers/unit.php | 6 +++++- app/helpers/config_helper.php | 2 +- app/helpers/site_helper.php | 2 +- app/lib/munkireport/AuthAD.php | 5 +++++ app/lib/munkireport/AuthSaml.php | 11 +++++++++++ app/views/dashboard/dashboard.php | 10 +++++++++- composer.json | 2 +- 8 files changed, 63 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 17ce3af54..d943a4642 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,33 @@ -### [5.1.5](https://github.com/munkireport/munkireport-php/compare/v5.1.4...HEAD) (Unreleased) +### [5.2.0](https://github.com/munkireport/munkireport-php/compare/v5.1.5...HEAD) (Unreleased) + +Some module updates and fixes. Inventory now has single app widget support: see https://github.com/munkireport/inventory/blob/master/README.md#single-app-widget +There's a fix for SAML groups that have comma's in the name. + +FEATURES +- Hide the empty blank "Group 0" machine group (#1130) + +MODULE UPDATES +- munkireport/inventory (v3.0 => v3.1) +- munkireport/crashplan (V1.5 => V1.6) +- munkireport/findmymac (v1.2 => v1.3) +- munkireport/mdm_status (v1.9 => v1.11) +- munkireport/power (v1.0 => v1.1) + +DEPENDENCY UPDATES +- symfony/translation-contracts (v1.1.7 => v2.0.1) +- symfony/polyfill-mbstring (v1.13.1 => v1.14.0) +- nesbot/carbon (2.29.1 => 2.30.0) +- symfony/polyfill-php73 (v1.13.1 => v1.14.0) +- symfony/service-contracts (v1.1.8 => v2.0.1) +- league/flysystem (1.0.63 => 1.0.64) +- doctrine/dbal (v2.9.3 => v2.10.1) +- symfony/polyfill-ctype (v1.13.1 => v1.14.0) +- vlucas/phpdotenv (v3.6.0 => v4.1.0) +- symfony/var-dumper (v4.4.4 => v5.0.4) +- tightenco/collect (v6.13.0 => v6.15.0) + + +### [5.1.5](https://github.com/munkireport/munkireport-php/compare/v5.1.4...v5.1.5) (February 02, 2020) Mostly module updates, and a small fix for apache servers. Security module now reports on Secure Boot and External Boot thanks to @poundbangbash Note that this change needs a database migration. diff --git a/app/controllers/unit.php b/app/controllers/unit.php index 7ba0d244d..bb27b32c0 100644 --- a/app/controllers/unit.php +++ b/app/controllers/unit.php @@ -62,11 +62,15 @@ public function get_machine_groups() foreach ($_SESSION['machine_groups'] as $group) { if ($mg_data = $mg->all($group)) { $out[] = $mg->all($group); - } else // Not in Machine_group table + } else if ($group != 0 && count($_SESSION['machine_groups']) != 0) // Not in Machine_group table { $out[] = array( 'name' => 'Group '.$group, 'groupid' => $group); + } else { + $out[] = array( + 'name' => 'Unassigned', + 'groupid' => $group); } } } else { diff --git a/app/helpers/config_helper.php b/app/helpers/config_helper.php index da16ec655..a09d8e3cb 100644 --- a/app/helpers/config_helper.php +++ b/app/helpers/config_helper.php @@ -12,7 +12,7 @@ function initDotEnv() { try { $envfile = defined('MUNKIREPORT_SETTINGS') ? MUNKIREPORT_SETTINGS : '.env'; - $dotenv = Dotenv::create(APP_ROOT, $envfile); + $dotenv = Dotenv::createMutable(APP_ROOT, $envfile); $dotenv->load(); } catch (InvalidPathException $e) { // .env is missing, but not really an issue since configuration is specified here anyway. diff --git a/app/helpers/site_helper.php b/app/helpers/site_helper.php index 97ea2b11c..d9ba15ae3 100644 --- a/app/helpers/site_helper.php +++ b/app/helpers/site_helper.php @@ -3,7 +3,7 @@ use munkireport\models\Machine_group, munkireport\lib\Modules, munkireport\lib\Dashboard; // Munkireport version (last number is number of commits) -$GLOBALS['version'] = '5.1.5.3921'; +$GLOBALS['version'] = '5.2.0.3922'; // Return version without commit count function get_version() diff --git a/app/lib/munkireport/AuthAD.php b/app/lib/munkireport/AuthAD.php index 827180f99..70609ef4d 100644 --- a/app/lib/munkireport/AuthAD.php +++ b/app/lib/munkireport/AuthAD.php @@ -26,6 +26,11 @@ public function login($login, $password) { $this->login = $login; if ($login && $password) { + + if( ! defined('LDAP_OPT_PROTOCOL_VERSION')){ + error('LDAP authentication failed: PHP is missing the LDAP extension'); + return false; + } if (conf('debug')) { diff --git a/app/lib/munkireport/AuthSaml.php b/app/lib/munkireport/AuthSaml.php index 9d6e8d175..e4040d02b 100644 --- a/app/lib/munkireport/AuthSaml.php +++ b/app/lib/munkireport/AuthSaml.php @@ -249,6 +249,9 @@ private function mapSamlAttrs($attrs) } } + // Make group names compliant + $this->_dirify($out['groups']); + // Check if we have a user if( $this->debug() && ! $out['user'] ) { @@ -259,6 +262,14 @@ private function mapSamlAttrs($attrs) return $out; } + // Replace comma with _ + private function _dirify(Array &$array) + { + array_walk($array, function(&$value, $key){ + $value = str_replace(',', '_', $value); + }); + } + private function debug() { return isset($this->config['debug']) && $this->config['debug'] == true; diff --git a/app/views/dashboard/dashboard.php b/app/views/dashboard/dashboard.php index 68c3e667d..9f1f32d07 100644 --- a/app/views/dashboard/dashboard.php +++ b/app/views/dashboard/dashboard.php @@ -8,7 +8,15 @@ $data):?> - view($this, $item, $data); ?> + + + view($this, $data['widget'], $data); ?> + + + + view($this, $item, $data); ?> + + diff --git a/composer.json b/composer.json index 33cd55e11..55f50efdf 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,7 @@ "rodneyrehm/plist": "^2.0", "doctrine/dbal": "~2.5", "defuse/php-encryption": "^2.1", - "vlucas/phpdotenv": "^3.1", + "vlucas/phpdotenv": "^4.0", "wikimedia/composer-merge-plugin": "^1.4", "munkireport/ard": "^2.0", "munkireport/reportdata": "^2.0",