mirror of
https://github.com/espocrm/espocrm.git
synced 2026-06-28 06:56:05 +00:00
39 lines
804 B
PHP
39 lines
804 B
PHP
<?php
|
|
|
|
namespace Espo\Controllers;
|
|
|
|
use Espo\Core\Utils as Utils;
|
|
|
|
class Settings extends \Espo\Core\Controllers\Base
|
|
{
|
|
|
|
public function actionRead($params, $data)
|
|
{
|
|
$isAdmin = $this->getContainer()->get('user')->isAdmin();
|
|
|
|
$data= $this->getContainer()->get('config')->getJsonData($isAdmin);
|
|
|
|
return array($data, 'Cannot get settings');
|
|
}
|
|
|
|
|
|
public function actionPatch($params, $data)
|
|
{
|
|
$isAdmin = $this->getContainer()->get('user')->isAdmin();
|
|
|
|
$result= $this->getContainer()->get('config')->setJsonData($data, $isAdmin);
|
|
|
|
if ($result===false) {
|
|
return array($result, 'Cannot save settings');
|
|
}
|
|
|
|
$data= $this->getContainer()->get('config')->getJsonData($isAdmin);
|
|
return array($data, 'Cannot get settings');
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
?>
|