isAdmin fixes
This commit is contained in:
@@ -9,32 +9,15 @@ class Settings extends \Espo\Core\Controllers\Base
|
||||
|
||||
public function actionRead($params, $data)
|
||||
{
|
||||
$admin = false;
|
||||
if ($this->getUser() instanceof \Espo\Entities\User) {
|
||||
$admin = $this->getUser()->isAdmin();
|
||||
}
|
||||
|
||||
return $this->getConfig()->getJsonData($admin);
|
||||
//return $this->getConfig()->getJsonData($this->getUser()->isAdmin());
|
||||
return $this->getConfig()->getJsonData($this->getUser()->isAdmin());
|
||||
}
|
||||
|
||||
public function actionPatch($params, $data)
|
||||
{
|
||||
$admin = false;
|
||||
if ($this->getUser() instanceof \Espo\Entities\User) {
|
||||
$admin = $this->getUser()->isAdmin();
|
||||
}
|
||||
|
||||
$result = $this->getConfig()->setJsonData($data, $admin);
|
||||
$result = $this->getConfig()->setJsonData($data, $this->getUser()->isAdmin());
|
||||
if ($result === false) {
|
||||
throw new Error('Cannot save settings');
|
||||
}
|
||||
return $this->getConfig()->getJsonData($admin);
|
||||
|
||||
/*$result = $this->getConfig()->setJsonData($data, $this->getUser()->isAdmin());
|
||||
if ($result === false) {
|
||||
throw new Error('Cannot save settings');
|
||||
}
|
||||
return $this->getConfig()->getJsonData($this->getUser()->isAdmin());*/
|
||||
return $this->getConfig()->getJsonData($this->getUser()->isAdmin());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ class Auth extends \Slim\Middleware
|
||||
if (!empty($routes[0])) {
|
||||
$routeConditions = $routes[0]->getConditions();
|
||||
if (isset($routeConditions['auth']) && $routeConditions['auth'] === false) {
|
||||
$this->container->setUser(new \Espo\Entities\User());
|
||||
$this->next->call();
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user