diff --git a/application/Espo/Core/Acl.php b/application/Espo/Core/Acl.php index 664c012637..8c187d2128 100644 --- a/application/Espo/Core/Acl.php +++ b/application/Espo/Core/Acl.php @@ -34,11 +34,15 @@ class Acl private $levelList = array('all', 'team', 'own', 'no'); - private $fileManager; + protected $fileManager; + + protected $metadata; - public function __construct(\Espo\Entities\User $user, $config = null, $fileManager = null) + public function __construct(\Espo\Entities\User $user, $config = null, $fileManager = null, $metadata = null) { - $this->user = $user; + $this->user = $user; + + $this->metadata = $metadata; if (!$this->user->isFetched()) { throw new Error(); @@ -197,32 +201,11 @@ class Acl private function initSolid() { - $this->data['User'] = array( - 'read' => 'all', - 'edit' => 'no', - 'delete' => 'no', - ); - $this->data['Team'] = array( - 'read' => 'all', - 'edit' => 'no', - 'delete' => 'no', - ); - $this->data['Role'] = false; - $this->data['Note'] = array( - 'read' => 'own', - 'edit' => 'own', - 'delete' => 'own', - ); - $this->data['EmailAddress'] = array( - 'read' => 'no', - 'edit' => 'no', - 'delete' => 'no', - ); - $this->data['Note'] = array( - 'read' => 'all', - 'edit' => 'own', - 'delete' => 'own', - ); + $data = $this->metadata->get('app.acl.solid', array()); + + foreach ($data as $entityName => $item) { + $this->data[$entityName] = $item; + } } private function merge($tables) diff --git a/application/Espo/Core/Container.php b/application/Espo/Core/Container.php index b20bbaf5b4..0fd76577bf 100644 --- a/application/Espo/Core/Container.php +++ b/application/Espo/Core/Container.php @@ -166,7 +166,8 @@ class Container return new $className( $this->get('user'), $this->get('config'), - $this->get('fileManager') + $this->get('fileManager'), + $this->get('metadata') ); } diff --git a/application/Espo/Resources/metadata/app/acl.json b/application/Espo/Resources/metadata/app/acl.json new file mode 100644 index 0000000000..69d5276105 --- /dev/null +++ b/application/Espo/Resources/metadata/app/acl.json @@ -0,0 +1,25 @@ +{ + "solid": { + "User": { + "read": "all", + "edit": "no", + "delete": "no" + }, + "Team": { + "read": "all", + "edit": "no", + "delete": "no" + }, + "Note": { + "read": "all", + "edit": "own", + "delete": "own" + }, + "EmailAddress": { + "read": "no", + "edit": "no", + "delete": "no" + }, + "Role": false + } +}