Fix code style
This commit is contained in:
@@ -172,7 +172,7 @@ class BaseService
|
||||
public function getCustomFieldClassMap()
|
||||
{
|
||||
$map = [];
|
||||
foreach($this->customFieldsClassMap as $key => $val) {
|
||||
foreach ($this->customFieldsClassMap as $key => $val) {
|
||||
$map[] = [$key, $val];
|
||||
}
|
||||
return $map;
|
||||
|
||||
@@ -61,7 +61,6 @@ class DomainAwareInputCleaner
|
||||
|
||||
$filterData = json_decode($filters, true);
|
||||
foreach ($filterData as $name => $value) {
|
||||
|
||||
if (!$this->isValidColumnName($name) || !$this->isValidFilterValue($value)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ class ModuleBuilder
|
||||
public $modules = array();
|
||||
public $user = null;
|
||||
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
$this->user = \Classes\BaseService::getInstance()->getCurrentUser();
|
||||
}
|
||||
|
||||
@@ -31,8 +31,8 @@ class ModuleTab
|
||||
$orderBy,
|
||||
$isActive = false,
|
||||
$options = array()
|
||||
)
|
||||
{
|
||||
) {
|
||||
|
||||
$this->modelPath = $modelPath;
|
||||
$this->name = $name;
|
||||
$this->class = $class;
|
||||
@@ -43,12 +43,14 @@ class ModuleTab
|
||||
$this->isActive = $isActive;
|
||||
|
||||
$this->options = array_merge(
|
||||
$options, [
|
||||
$options,
|
||||
[
|
||||
"setObjectTypeName" => "'{$this->name}'",
|
||||
"setAccess" => "data.permissions.{$this->name} ? data.permissions.{$this->name} : {}",
|
||||
"setDataPipe" => 'new IceDataPipe(modJsList.tab' . $this->name . ')',
|
||||
"setRemoteTable" => true,
|
||||
]);
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
public function getHTML()
|
||||
@@ -67,8 +69,8 @@ class ModuleTab
|
||||
{
|
||||
$active = ($this->isActive)?" active":"";
|
||||
$html = '<div class="tab-pane'.$active.'" id="tabPage'.$this->name.'">'.
|
||||
'<div id="'.$this->name.'Table" class="reviewBlock" data-content="List" style="padding-left:5px;"></div>'.
|
||||
'<div id="'.$this->name.'Form"></div>'.
|
||||
'<div id="'.$this->name.'Table" class="reviewBlock" data-content="List" style="padding-left:5px;"></div>'.
|
||||
'<div id="'.$this->name.'Form"></div>'.
|
||||
'<div id="'.$this->name.'FilterForm"></div>'.
|
||||
'</div>';
|
||||
|
||||
|
||||
@@ -7,7 +7,8 @@ use Utils\LogManager;
|
||||
|
||||
class SAMLManager
|
||||
{
|
||||
public function getSSOEmail($samlData, $relayState) {
|
||||
public function getSSOEmail($samlData, $relayState)
|
||||
{
|
||||
// Service Providers Assertion Consumer Service (ACS) URL
|
||||
$acsUrl = CLIENT_BASE_URL.'login.php';
|
||||
$samlResponse = htmlspecialchars($samlData);
|
||||
@@ -27,15 +28,15 @@ class SAMLManager
|
||||
$statusString = $status->item(0)->getAttribute('Value');
|
||||
|
||||
|
||||
$statusArray = explode(':',$statusString);
|
||||
if(array_key_exists(7, $statusArray)){
|
||||
$statusArray = explode(':', $statusString);
|
||||
if (array_key_exists(7, $statusArray)) {
|
||||
$status = $statusArray[7];
|
||||
}
|
||||
|
||||
if ('Success' !== $status) {
|
||||
$StatusMessage = $xpath->query('/samlp:Response/samlp:Status/samlp:StatusMessage', $doc)->item(0);
|
||||
LogManager::getInstance()->error('SAML login failed: status = '. $status);
|
||||
if(!empty($StatusMessage)) {
|
||||
if (!empty($StatusMessage)) {
|
||||
$StatusMessage = $StatusMessage->nodeValue;
|
||||
LogManager::getInstance()->error('SAML login failed: status message = '. $StatusMessage);
|
||||
}
|
||||
@@ -51,17 +52,31 @@ class SAMLManager
|
||||
$certFingerPrint = MoXMLSecurityKey::getRawThumbprint($x509cert);
|
||||
$certFingerPrint = preg_replace('/\s+/', '', $certFingerPrint);
|
||||
$validSignature = false;
|
||||
if(!empty($responseSignatureData)) {
|
||||
$validSignature = \Utilities::processResponse($acsUrl, $certFingerPrint, $responseSignatureData, $samlResponse, 0, $relayState);
|
||||
if (!empty($responseSignatureData)) {
|
||||
$validSignature = \Utilities::processResponse(
|
||||
$acsUrl,
|
||||
$certFingerPrint,
|
||||
$responseSignatureData,
|
||||
$samlResponse,
|
||||
0,
|
||||
$relayState
|
||||
);
|
||||
LogManager::getInstance()->error('SAML: response signature validity :'.$validSignature);
|
||||
}
|
||||
|
||||
if(!empty($assertionSignatureData)) {
|
||||
$validSignature = \Utilities::processResponse($acsUrl, $certFingerPrint, $assertionSignatureData, $samlResponse, 0, $relayState);
|
||||
if (!empty($assertionSignatureData)) {
|
||||
$validSignature = \Utilities::processResponse(
|
||||
$acsUrl,
|
||||
$certFingerPrint,
|
||||
$assertionSignatureData,
|
||||
$samlResponse,
|
||||
0,
|
||||
$relayState
|
||||
);
|
||||
LogManager::getInstance()->error('SAML: response signature validity :'.$validSignature);
|
||||
}
|
||||
|
||||
if(!$validSignature) {
|
||||
if (!$validSignature) {
|
||||
LogManager::getInstance()->error('Invalid response or assertion signature');
|
||||
return false;
|
||||
}
|
||||
@@ -82,4 +97,4 @@ class SAMLManager
|
||||
|
||||
return $ssoEmail;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,17 +28,20 @@ class SettingsManager
|
||||
return self::$me;
|
||||
}
|
||||
|
||||
public function addEncryptedSetting($name) {
|
||||
public function addEncryptedSetting($name)
|
||||
{
|
||||
if (!$this->isEncryptedSetting($name)) {
|
||||
$this->encryptedSettings[] = $name;
|
||||
}
|
||||
}
|
||||
|
||||
public function isEncryptedSetting($name) {
|
||||
public function isEncryptedSetting($name)
|
||||
{
|
||||
return in_array($name, $this->encryptedSettings);
|
||||
}
|
||||
|
||||
public function getInstanceKey() {
|
||||
public function getInstanceKey()
|
||||
{
|
||||
$settings = new Setting();
|
||||
$settings->Load("name = ?", array("Instance: Key"));
|
||||
if ($settings->name != "Instance: Key") {
|
||||
@@ -47,16 +50,17 @@ class SettingsManager
|
||||
return $settings->value;
|
||||
}
|
||||
|
||||
private function encrypt($value) {
|
||||
private function encrypt($value)
|
||||
{
|
||||
$id = BaseService::getInstance()->getInstanceId();
|
||||
$key = $this->getInstanceKey();
|
||||
return AesCtr::encrypt($value, $id.$key, 256);
|
||||
}
|
||||
|
||||
public function encryptSetting($name, $value) {
|
||||
public function encryptSetting($name, $value)
|
||||
{
|
||||
// check the existence of prefix and encrypt only if need to avoid double encryption
|
||||
if (
|
||||
$this->isEncryptedSetting($name)
|
||||
if ($this->isEncryptedSetting($name)
|
||||
&& substr($value, 0, strlen(self::ENCRYPTED_PREFIX)) !== self::ENCRYPTED_PREFIX
|
||||
) {
|
||||
$value = self::ENCRYPTED_PREFIX.$this->encrypt($value);
|
||||
@@ -65,15 +69,16 @@ class SettingsManager
|
||||
return $value;
|
||||
}
|
||||
|
||||
private function decrypt($value) {
|
||||
private function decrypt($value)
|
||||
{
|
||||
$id = BaseService::getInstance()->getInstanceId();
|
||||
$key = $this->getInstanceKey();
|
||||
return AesCtr::decrypt($value, $id.$key, 256);
|
||||
}
|
||||
|
||||
public function decryptSetting($name, $value) {
|
||||
if (
|
||||
$this->isEncryptedSetting($name)
|
||||
public function decryptSetting($name, $value)
|
||||
{
|
||||
if ($this->isEncryptedSetting($name)
|
||||
&& substr($value, 0, strlen(self::ENCRYPTED_PREFIX)) === self::ENCRYPTED_PREFIX
|
||||
) {
|
||||
$value = $this->decrypt(substr($value, strlen(self::ENCRYPTED_PREFIX)));
|
||||
@@ -134,7 +139,8 @@ class SettingsManager
|
||||
}
|
||||
}
|
||||
|
||||
public function getDeprecatedSettings() {
|
||||
public function getDeprecatedSettings()
|
||||
{
|
||||
return [
|
||||
'Attendance: Work Week Start Day',
|
||||
'Attendance: Overtime Calculation Class'
|
||||
|
||||
Reference in New Issue
Block a user