maxEmailAccountCount
This commit is contained in:
@@ -96,6 +96,7 @@ return array (
|
||||
'emailMessageMaxSize' => 10,
|
||||
'notificationsCheckInterval' => 10,
|
||||
'disabledCountQueryEntityList' => array('Email'),
|
||||
'maxEmailAccountCount' => 2,
|
||||
'isInstalled' => false,
|
||||
);
|
||||
|
||||
|
||||
@@ -115,6 +115,7 @@ return array (
|
||||
'ldapTryUsernameSplit',
|
||||
'ldapOptReferrals',
|
||||
'ldapCreateEspoUser',
|
||||
'maxEmailAccountCount'
|
||||
),
|
||||
'isInstalled' => false,
|
||||
);
|
||||
|
||||
@@ -94,6 +94,15 @@ class EmailAccount extends Record
|
||||
|
||||
public function createEntity($data)
|
||||
{
|
||||
if (!$this->getUser()->isAdmin()) {
|
||||
$count = $this->getEntityManager()->getRepository('EmailAccount')->where(array(
|
||||
'assignedUserId' => $this->getUser()->id
|
||||
))->count();
|
||||
if ($count >= $this->getConfig()->get('maxEmailAccountCount', \PHP_INT_MAX)) {
|
||||
throw new Forbidden();
|
||||
}
|
||||
}
|
||||
|
||||
$entity = parent::createEntity($data);
|
||||
if ($entity) {
|
||||
if (!$this->getUser()->isAdmin()) {
|
||||
|
||||
Reference in New Issue
Block a user