This commit is contained in:
jf-cbd
2025-02-27 17:56:46 +01:00
parent a9e10742ec
commit c9f32311b4
2 changed files with 22 additions and 12 deletions

View File

@@ -127,8 +127,12 @@ class ObjectResult
{
foreach($this->fields as $sAttCode => $value)
{
try{
$oAttDef = MetaModel::GetAttributeDef($this->class, $sAttCode);
if ($oAttDef instanceof AttributeEncryptedString || $oAttDef instanceof AttributePassword)
} catch (Exception $e) { // for special cases like ID
continue;
}
if ($oAttDef instanceof AttributeEncryptedString || $oAttDef instanceof AttributePassword || $oAttDef instanceof AttributeOneWayPassword)
{
$this->fields[$sAttCode] = '******';
}
@@ -704,14 +708,15 @@ class CoreServices implements iRestServiceProvider, iRestInputSanitizer
$sClass = $aJsonData['class'];
foreach ($aJsonData['fields'] as $sAttCode => $value) {
$oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode);
if ($oAttDef instanceof AttributePassword || $oAttDef instanceof AttributeEncryptedPassword) {
if ($oAttDef instanceof AttributeEncryptedString || $oAttDef instanceof AttributePassword || $oAttDef instanceof AttributeOneWayPassword) {
$aJsonData['fields'][$sAttCode] = '*****';
}
}
// TODO : fields type relations avec champs sensible dedans
// TODO refacto
break;
}
return json_encode($aJsonData);
return json_encode($aJsonData, JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT);
}
/**