Work in progress

This commit is contained in:
denis.flaven@combodo.com
2025-02-27 12:17:52 +01:00
parent affed69999
commit 944b1f557d
3 changed files with 52 additions and 3 deletions

View File

@@ -122,6 +122,18 @@ class ObjectResult
{
$this->fields[$sAttCode] = $this->MakeResultValue($oObject, $sAttCode, $bExtendedOutput);
}
public function SanitizeContent()
{
foreach($this->fields as $sAttCode => $value)
{
$oAttDef = MetaModel::GetAttributeDef($this->class, $sAttCode);
if ($oAttDef instanceof AttributeEncryptedString)
{
$this->fields[$sAttCode] = '******';
}
}
}
}
@@ -181,6 +193,16 @@ class RestResultWithObjects extends RestResult
$sObjKey = get_class($oObject).'::'.$oObject->GetKey();
$this->objects[$sObjKey] = $oObjRes;
}
public function SanitizeContent()
{
parent::SanitizeContent();
foreach($this->objects as $sObjKey => $oObjRes)
{
$oObjRes->SanitizeContent();
}
}
}
class RestResultWithRelations extends RestResultWithObjects
@@ -247,7 +269,7 @@ class RestDelete
*
* @package Core
*/
class CoreServices implements iRestServiceProvider
class CoreServices implements iRestServiceProvider, iRestInputSanitizer
{
/**
* Enumerate services delivered by this class
@@ -663,6 +685,12 @@ class CoreServices implements iRestServiceProvider
}
return $oResult;
}
public function SanitizeJsonInput(string $sJsonInput): string
{
//TODO
return 'TODO: sanitized input';
}
/**
* Helper for object deletion