Key verification

This commit is contained in:
Thilina Pituwala
2020-05-31 09:21:24 +02:00
parent dd9e904378
commit 648901b104

View File

@@ -285,8 +285,8 @@ class BaseService
$childCompaniesIds = array(); $childCompaniesIds = array();
if (\Classes\SettingsManager::getInstance()->getSetting( if (\Classes\SettingsManager::getInstance()->getSetting(
'System: Child Company Structure Managers Enabled' 'System: Child Company Structure Managers Enabled'
) == '1' ) == '1'
) { ) {
$childCompaniesResp = \Company\Common\Model\CompanyStructure::getAllChildCompanyStructures( $childCompaniesResp = \Company\Common\Model\CompanyStructure::getAllChildCompanyStructures(
$cempObj->department $cempObj->department
@@ -479,8 +479,8 @@ class BaseService
$childCompaniesIds = array(); $childCompaniesIds = array();
if (SettingsManager::getInstance()->getSetting( if (SettingsManager::getInstance()->getSetting(
'System: Child Company Structure Managers Enabled' 'System: Child Company Structure Managers Enabled'
) == '1' ) == '1'
) { ) {
$childCompaniesResp = CompanyStructure::getAllChildCompanyStructures($cempObj->department); $childCompaniesResp = CompanyStructure::getAllChildCompanyStructures($cempObj->department);
$childCompanies = $childCompaniesResp->getObject(); $childCompanies = $childCompaniesResp->getObject();
@@ -560,8 +560,8 @@ class BaseService
$childCompaniesIds = array(); $childCompaniesIds = array();
if (SettingsManager::getInstance()->getSetting( if (SettingsManager::getInstance()->getSetting(
'System: Child Company Structure Managers Enabled' 'System: Child Company Structure Managers Enabled'
) == '1' ) == '1'
) { ) {
$childCompaniesResp = CompanyStructure::getAllChildCompanyStructures($cempObj->department); $childCompaniesResp = CompanyStructure::getAllChildCompanyStructures($cempObj->department);
$childCompanies = $childCompaniesResp->getObject(); $childCompanies = $childCompaniesResp->getObject();
@@ -1350,7 +1350,6 @@ class BaseService
$settings->name = "Instance: Key"; $settings->name = "Instance: Key";
} }
$settings->value = $key; $settings->value = $key;
$settings->category = 'Instance';
$settings->Save(); $settings->Save();
} }
@@ -1377,17 +1376,11 @@ class BaseService
return false; return false;
} }
/*
$data = AesCtr::decrypt($key, $instanceId, 256); $data = AesCtr::decrypt($key, $instanceId, 256);
$arr = explode("|", $data); $arr = explode("|", $data);
if ($arr[0] == KEY_PREFIX && $arr[1] == $instanceId) { if ($arr[0] == KEY_PREFIX && $arr[1] == $instanceId) {
return true; return true;
} }
*/
if (strlen($key) > 20) {
return true;
}
return false; return false;
} }
@@ -1786,8 +1779,8 @@ END;
) { ) {
$departmentHeadFound = true; $departmentHeadFound = true;
} elseif (SettingsManager::getInstance()->getSetting( } elseif (SettingsManager::getInstance()->getSetting(
'System: Child Company Structure Managers Enabled' 'System: Child Company Structure Managers Enabled'
) == '1' ) == '1'
) { ) {
$companyStructure = new CompanyStructure(); $companyStructure = new CompanyStructure();
$companyStructure->Load('id = ?', array($subordinate->department)); $companyStructure->Load('id = ?', array($subordinate->department));
@@ -1807,7 +1800,7 @@ END;
$companyStructure->Load('id = ?', array($parentCompanyStructure)); $companyStructure->Load('id = ?', array($parentCompanyStructure));
} }
} while (!empty($companyStructure->id) } while (!empty($companyStructure->id)
&& !empty($parentCompanyStructure) && !empty($parentCompanyStructure)
); );
} }