Example #1
0
 public function __construct(User $user, Config $config = null, FileManager $fileManager = null, Metadata $metadata = null, FieldManager $fieldManager = null)
 {
     $this->data = (object) ['table' => (object) [], 'fieldTable' => (object) [], 'fieldTableQuickAccess' => (object) []];
     $this->user = $user;
     $this->metadata = $metadata;
     if ($fieldManager) {
         $this->fieldManager = $fieldManager;
     }
     if (!$this->user->isFetched()) {
         throw new Error('User must be fetched before ACL check.');
     }
     $this->user->loadLinkMultipleField('teams');
     if ($fileManager) {
         $this->fileManager = $fileManager;
     }
     $this->cacheFile = 'data/cache/application/acl/' . $user->id . '.php';
     if ($config && $config->get('useCache') && file_exists($this->cacheFile)) {
         $cached = (include $this->cacheFile);
         $this->data = $cached;
     } else {
         $this->load();
         if ($config && $fileManager && $config->get('useCache')) {
             $this->buildCache();
         }
     }
 }
Example #2
0
 public function __construct(User $user, Config $config = null, FileManager $fileManager = null, Metadata $metadata = null, FieldManager $fieldManager = null)
 {
     $this->data = (object) ['table' => (object) [], 'fieldTable' => (object) [], 'fieldTableQuickAccess' => (object) []];
     $this->user = $user;
     $this->metadata = $metadata;
     if ($fieldManager) {
         $this->fieldManager = $fieldManager;
     }
     if (!$this->user->isFetched()) {
         throw new Error('User must be fetched before ACL check.');
     }
     $this->user->loadLinkMultipleField('teams');
     if ($fileManager) {
         $this->fileManager = $fileManager;
     }
     $this->valuePermissionList = $this->metadata->get('app.' . $this->type . '.defs.valuePermissionList', $this->valuePermissionList);
     $this->initCacheFilePath();
     if ($config && $config->get('useCache') && file_exists($this->cacheFilePath)) {
         $cached = (include $this->cacheFilePath);
         $this->data = $cached;
     } else {
         $this->load();
         if ($config && $fileManager && $config->get('useCache')) {
             $this->buildCache();
         }
     }
 }
Example #3
0
 public function __construct(\Espo\Core\Utils\Config $config = null)
 {
     $params = null;
     if (isset($config)) {
         $params = array('defaultPermissions' => $config->get('defaultPermissions'), 'permissionMap' => $config->get('permissionMap'));
     }
     $this->permission = new Permission($this, $params);
 }