acl report dashlets
This commit is contained in:
@@ -125,6 +125,19 @@ class Acl
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
public function getLevel($scope, $action)
|
||||
{
|
||||
if ($this->user->isAdmin()) {
|
||||
return 'all';
|
||||
}
|
||||
if (array_key_exists($scope, $this->data)) {
|
||||
if (array_key_exists($action, $this->data[$scope])) {
|
||||
return $this->data[$scope][$action];
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function check($subject, $action = null, $isOwner = null, $inTeam = null)
|
||||
{
|
||||
if ($this->user->isAdmin()) {
|
||||
|
||||
@@ -29,7 +29,8 @@ class Opportunity extends \Espo\Core\Controllers\Record
|
||||
{
|
||||
public function actionReportByLeadSource($params, $data, $request)
|
||||
{
|
||||
if (!$this->getAcl()->check('Lead', 'read')) {
|
||||
$level = $this->getAcl()->getLevel('Lead', 'read');
|
||||
if (!$level || $level == 'own') {
|
||||
throw new Forbidden();
|
||||
}
|
||||
|
||||
@@ -41,7 +42,8 @@ class Opportunity extends \Espo\Core\Controllers\Record
|
||||
|
||||
public function actionReportByStage($params, $data, $request)
|
||||
{
|
||||
if (!$this->getAcl()->check('Opportunity', 'read')) {
|
||||
$level = $this->getAcl()->getLevel('Opportunity', 'read');
|
||||
if (!$level || $level == 'own') {
|
||||
throw new Forbidden();
|
||||
}
|
||||
|
||||
@@ -53,7 +55,8 @@ class Opportunity extends \Espo\Core\Controllers\Record
|
||||
|
||||
public function actionReportSalesByMonth($params, $data, $request)
|
||||
{
|
||||
if (!$this->getAcl()->check('Opportunity', 'read')) {
|
||||
$level = $this->getAcl()->getLevel('Opportunity', 'read');
|
||||
if (!$level || $level == 'own') {
|
||||
throw new Forbidden();
|
||||
}
|
||||
|
||||
@@ -65,7 +68,8 @@ class Opportunity extends \Espo\Core\Controllers\Record
|
||||
|
||||
public function actionReportSalesPipeline($params, $data, $request)
|
||||
{
|
||||
if (!$this->getAcl()->check('Opportunity', 'read')) {
|
||||
$level = $this->getAcl()->getLevel('Opportunity', 'read');
|
||||
if (!$level || $level == 'own') {
|
||||
throw new Forbidden();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user