acl table
This commit is contained in:
@@ -24,6 +24,6 @@ namespace Espo\Controllers;
|
||||
|
||||
class Role extends \Espo\Core\Controllers\Record
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,30 @@
|
||||
|
||||
namespace Espo\Controllers;
|
||||
|
||||
class User extends \Espo\Core\Controllers\Record
|
||||
{
|
||||
use \Espo\Core\Exceptions\Error;
|
||||
use \Espo\Core\Exceptions\NotFound;
|
||||
use \Espo\Core\Exceptions\Forbidden;
|
||||
|
||||
class User extends \Espo\Core\Controllers\Record
|
||||
{
|
||||
public function actionAcl($params, $data, $request)
|
||||
{
|
||||
$userId = $request->get('id');
|
||||
if (empty($userId)) {
|
||||
throw new Error();
|
||||
}
|
||||
|
||||
if (!$this->getUser()->isAdmin() && $this->getUser()->id != $userId) {
|
||||
throw new Forbidden();
|
||||
}
|
||||
|
||||
$user = $this->getEntityManager()->getEntity('User', $userId);
|
||||
if (empty($user)) {
|
||||
throw new NotFound();
|
||||
}
|
||||
|
||||
$acl = new \Espo\Core\Acl($user);
|
||||
|
||||
return $acl->toArray();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,10 +36,9 @@ class Acl
|
||||
|
||||
private $fileManager;
|
||||
|
||||
public function __construct(\Espo\Entities\User $user, $config, $fileManager)
|
||||
public function __construct(\Espo\Entities\User $user, $config = null, $fileManager = null)
|
||||
{
|
||||
$this->user = $user;
|
||||
$this->fileManager = $fileManager;
|
||||
$this->user = $user;
|
||||
|
||||
if (!$this->user->isFetched()) {
|
||||
throw new Error();
|
||||
@@ -47,17 +46,23 @@ class Acl
|
||||
|
||||
$this->user->loadLinkMultipleField('teams');
|
||||
|
||||
if ($fileManager) {
|
||||
$this->fileManager = $fileManager;
|
||||
}
|
||||
|
||||
$this->cacheFile = 'data/cache/application/acl/' . $user->id . '.php';
|
||||
|
||||
if ($config->get('useCache') && file_exists($this->cacheFile)) {
|
||||
if ($config && $config->get('useCache') && file_exists($this->cacheFile)) {
|
||||
$cached = include $this->cacheFile;
|
||||
} else {
|
||||
$this->load();
|
||||
$this->initSolid();
|
||||
if ($config->get('useCache')) {
|
||||
if ($config && $fileManager && $config->get('useCache')) {
|
||||
$this->buildCache();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function checkScope($scope, $action = null, $isOwner = null, $inTeam = null)
|
||||
|
||||
Reference in New Issue
Block a user