Skip to content

Commit

Permalink
webui: check major version compatibility between webui and DIR
Browse files Browse the repository at this point in the history
To ensure the installed WEBUI and DIR have the same version
because of compatibility reasons, this commit introduces a version
check at login time which provides an error message if versions
do not match.

Fixes #871: UI will not load complete
  • Loading branch information
fbergkemper committed Jul 6, 2021
1 parent c399a7a commit a30180d
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions webui/module/Auth/src/Auth/Controller/AuthController.php
Expand Up @@ -142,6 +142,12 @@ public function loginAction()
return $this->createNewLoginForm($form, $multi_dird_env, $apicheck, $this->bsock);
}

$versioncheck = $this->checkVersionCompatibilityDIRD();

if($versioncheck !== true) {
return $this->createNewLoginForm($form, $multi_dird_env, $versioncheck, $this->bsock);
}

$aclcheck = $this->checkACLStatusDIRD();

if(!$aclcheck) {
Expand Down Expand Up @@ -208,6 +214,25 @@ private function createNewLoginForm($form, $multi_dird_env = null, $err_msg = nu
);
}

/**
* DIRD version compatibility check
*
* @return mixed
*/
private function checkVersionCompatibilityDIRD() {
include 'version.php'; // provides bareos_full_version (installed ui version)
$dird_version_array = $this->getDirectorModel()->getDirectorVersion($this->bsock);
$dird_version = $dird_version_array['version'];
// compare major version
$dird_major_version = explode('.', $dird_version)[0];
$ui_major_version = explode('.', $bareos_full_version)[0];
if($dird_major_version !== $ui_major_version) {
$err_msg = 'Error: Bareos WebUI ('.$bareos_full_version.') requires a Director of the same major release ('.$dird_major_version.'). The Director version is '.$dird_version.'.';
return $err_msg;
}
return true;
}

/**
* DIRD API check
*
Expand Down

0 comments on commit a30180d

Please sign in to comment.