email address search check email create access

This commit is contained in:
yuri
2016-02-05 16:06:07 +02:00
parent d0f715863c
commit e727196424
2 changed files with 10 additions and 3 deletions
@@ -38,6 +38,9 @@ class EmailAddress extends \Espo\Core\Controllers\Record
if (!$this->getAcl()->checkScope('Email')) {
throw new Forbidden();
}
if (!$this->getAcl()->checkScope('Email', 'create')) {
throw new Forbidden();
}
$q = $request->get('q');
$limit = intval($request->get('limit'));
if (empty($limit) || $limit > 30) {
+7 -3
View File
@@ -58,7 +58,9 @@ class EmailAddress extends Record
'limit' => $limit
);
$this->getSelectManagerFactory()->create($entityType)->manageAccess($searchParams);
$selectManager = $this->getSelectManagerFactory()->create($entityType);
$selectManager->applyAccess($searchParams);
$collection = $this->getEntityManager()->getRepository($entityType)->find($searchParams);
@@ -91,13 +93,15 @@ class EmailAddress extends Record
protected function findInInboundEmail($query, $limit, &$result)
{
$pdo = $this->getEntityManager()->getPDO();
$qu = $this->getEntityManager()->getQuery()->createSelectQuery('InboundEmail', [
$selectParams = [
'select' => ['id', 'name', 'emailAddress'],
'whereClause' => [
'emailAddress*' => $query . '%'
],
'orderBy' => 'name',
]);
];
$qu = $this->getEntityManager()->getQuery()->createSelectQuery('InboundEmail', $selectParams);
$sth = $pdo->prepare($qu);
$sth->execute();