mirror of
https://github.com/espocrm/espocrm.git
synced 2026-06-28 06:56:05 +00:00
Merge branch 'master' of ssh://172.20.0.1/var/git/espo/backend
This commit is contained in:
@@ -117,6 +117,32 @@ class Config
|
||||
return $lastBranch;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether parameter is set
|
||||
*
|
||||
* @param string $name
|
||||
* @return bool
|
||||
*/
|
||||
public function has($name)
|
||||
{
|
||||
$keys = explode('.', $name);
|
||||
|
||||
$lastBranch = $this->loadConfig();
|
||||
foreach ($keys as $keyName) {
|
||||
if (isset($lastBranch[$keyName]) && (is_array($lastBranch) || is_object($lastBranch))) {
|
||||
if (is_array($lastBranch)) {
|
||||
$lastBranch = $lastBranch[$keyName];
|
||||
} else {
|
||||
$lastBranch = $lastBranch->$keyName;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set an option to the config
|
||||
*
|
||||
|
||||
@@ -43,6 +43,7 @@ class App extends \Espo\Core\Services\Base
|
||||
$this->addDependency('acl');
|
||||
$this->addDependency('container');
|
||||
$this->addDependency('entityManager');
|
||||
$this->addDependency('metadata');
|
||||
}
|
||||
|
||||
protected function getPreferences()
|
||||
@@ -83,6 +84,21 @@ class App extends \Espo\Core\Services\Base
|
||||
$settings->$item = $this->getConfig()->get($item);
|
||||
}
|
||||
|
||||
if ($this->getUser()->isAdmin()) {
|
||||
foreach ($this->getConfig()->get('adminItems') as $item) {
|
||||
if ($this->getConfig()->has($item)) {
|
||||
$settings->$item = $this->getConfig()->get($item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$settingsFieldDefs = $this->getInjection('metadata')->get('entityDefs.Settings.fields', []);
|
||||
foreach ($settingsFieldDefs as $field => $d) {
|
||||
if ($d['type'] === 'password') {
|
||||
unset($settings->$field);
|
||||
}
|
||||
}
|
||||
|
||||
unset($userData->authTokenId);
|
||||
unset($userData->password);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user