permission consts

This commit is contained in:
Yuri Kuznetsov
2024-04-19 14:33:54 +03:00
parent 5be0f5c71e
commit 42645a9bc1
25 changed files with 66 additions and 53 deletions
+10 -1
View File
@@ -36,17 +36,26 @@ use Espo\Core\Acl;
use Espo\Core\Api\Request;
use Espo\Core\Api\Response;
use Espo\Core\Exceptions\NotFound;
use Espo\Tools\DataPrivacy\Erasor;
class DataPrivacy
{
/**
* @throws Forbidden
*/
public function __construct(private Erasor $erasor, private Acl $acl)
{
if ($this->acl->getPermissionLevel('dataPrivacy') === Acl\Table::LEVEL_NO) {
if ($this->acl->getPermissionLevel(Acl\Permission::DATA_PRIVACY) === Acl\Table::LEVEL_NO) {
throw new Forbidden();
}
}
/**
* @throws BadRequest
* @throws Forbidden
* @throws NotFound
*/
public function postActionErase(Request $request, Response $response): void
{
$data = $request->getParsedBody();