actions allowed

This commit is contained in:
Yuri Kuznetsov
2021-04-30 22:36:45 +03:00
parent 038d0e038b
commit 7524bc3bc3
36 changed files with 489 additions and 19 deletions
@@ -105,7 +105,31 @@ class ActionFactory
return true;
}
if ($this->needsToBeAllowed($entityType)) {
if (!$this->isAllowed($action, $entityType)) {
return true;
}
}
return $this->metadata
->get(['recordDefs', $entityType, 'actions', $action, 'disabled']) ?? false;
}
private function needsToBeAllowed(string $entityType): bool
{
$isObject = $this->metadata->get(['scopes', $entityType, 'object']) ?? false;
if (!$isObject) {
return true;
}
return $this->metadata
->get(['recordDefs', $entityType, 'notAllowedActionsDisabled']) ?? false;
}
private function isAllowed(string $action, string $entityType): bool
{
return $this->metadata
->get(['recordDefs', $entityType, 'actions', $action, 'allowed']) ?? false;
}
}
@@ -112,7 +112,31 @@ class MassActionFactory
return true;
}
if ($this->needsToBeAllowed($entityType)) {
if (!$this->isAllowed($action, $entityType)) {
return true;
}
}
return $this->metadata
->get(['recordDefs', $entityType, 'massActions', $action, 'disabled']) ?? false;
}
private function needsToBeAllowed(string $entityType): bool
{
$isObject = $this->metadata->get(['scopes', $entityType, 'object']) ?? false;
if (!$isObject) {
return true;
}
return $this->metadata
->get(['recordDefs', $entityType, 'notAllowedActionsDisabled']) ?? false;
}
private function isAllowed(string $action, string $entityType): bool
{
return $this->metadata
->get(['recordDefs', $entityType, 'massActions', $action, 'allowed']) ?? false;
}
}
@@ -3,6 +3,9 @@
"views": {
"detail": "views/dashboard-template/detail"
},
"recordViews": {
"list": "views/dashboard-template/record/list"
},
"menu": {
"detail": {
"buttons": [
@@ -4,6 +4,7 @@
"edit": "views/email-filter/modals/edit"
},
"recordViews": {
"list": "views/email-filter/record/list",
"detail": "views/email-filter/record/detail",
"edit": "views/email-filter/record/edit",
"editQuick": "views/email-filter/record/edit-small",
@@ -1,5 +1,8 @@
{
"controller": "controllers/layout-set",
"recordViews": {
"list": "views/layout-set/record/list"
},
"searchPanelDisabled": true,
"duplicateDisabled": true,
"relationshipPanels": {
@@ -2,7 +2,8 @@
"controller": "controllers/record",
"searchPanelDisabled": true,
"recordViews": {
"detail": "views/lead-capture/record/detail"
"detail": "views/lead-capture/record/detail",
"list": "views/lead-capture/record/list"
},
"dynamicLogic": {
"fields": {
@@ -1,12 +1,15 @@
{
"controller": "controllers/record",
"relationshipPanels": {
"users": {
"create": false,
"rowActionsView": "views/record/row-actions/relationship-unlink-only",
"layout": "listSmall",
"selectPrimaryFilterName": "activePortal"
}
},
"searchPanelDisabled": true
"controller": "controllers/record",
"recordViews": {
"list":"views/portal/record/list"
},
"relationshipPanels": {
"users": {
"create": false,
"rowActionsView": "views/record/row-actions/relationship-unlink-only",
"layout": "listSmall",
"selectPrimaryFilterName": "activePortal"
}
},
"searchPanelDisabled": true
}
@@ -1,5 +1,8 @@
{
"controller": "controllers/record",
"recordViews": {
"list": "views/webhook/record/list"
},
"dynamicLogic": {
"fields": {
"event": {
@@ -4,5 +4,10 @@
],
"listLoaderClassNameList": [
"Espo\\Core\\FieldProcessing\\LinkParent\\TargetLoader"
]
],
"massActions": {
"delete": {
"allowed": true
}
}
}
@@ -0,0 +1,7 @@
{
"massActions": {
"delete": {
"allowed": true
}
}
}
@@ -1,10 +1,7 @@
{
"massActions": {
"update": {
"disabled": true
},
"recalculateFormula": {
"disabled": true
"delete": {
"allowed": true
}
}
}
@@ -0,0 +1,18 @@
{
"assignmentNotificatorClassName": "Espo\\Classes\\AssignmentNotificators\\Email",
"readLoaderClassNameList": [
"Espo\\Classes\\FieldProcessing\\Email\\AddressDataLoader",
"Espo\\Classes\\FieldProcessing\\Email\\UserColumnsLoader"
],
"listLoaderClassNameList": [
"Espo\\Classes\\FieldProcessing\\Email\\StringDataLoader"
],
"massActions": {
"update": {
"allowed": true
},
"delete": {
"allowed": true
}
}
}
@@ -0,0 +1,7 @@
{
"massActions": {
"delete": {
"allowed": true
}
}
}
@@ -0,0 +1,10 @@
{
"massActions": {
"update": {
"allowed": true
},
"delete": {
"allowed": true
}
}
}
@@ -0,0 +1,7 @@
{
"massActions": {
"delete": {
"allowed": true
}
}
}
@@ -0,0 +1,10 @@
{
"massActions": {
"delete": {
"allowed": true
},
"update": {
"allowed": true
}
}
}
@@ -0,0 +1,15 @@
{
"massActions": {
"delete": {
"allowed": true
},
"update": {
"allowed": true
}
},
"actions": {
"merge": {
"allowed": true
}
}
}
@@ -1,5 +1,10 @@
{
"readLoaderClassNameList": [
"Espo\\Classes\\FieldProcessing\\Import\\CountsLoader"
]
],
"massActions": {
"delete": {
"allowed": true
}
}
}
@@ -0,0 +1,10 @@
{
"massActions": {
"update": {
"allowed": true
},
"delete": {
"allowed": true
}
}
}
@@ -0,0 +1,7 @@
{
"massActions": {
"delete": {
"allowed": true
}
}
}
@@ -0,0 +1,7 @@
{
"massActions": {
"delete": {
"allowed": true
}
}
}
@@ -0,0 +1,10 @@
{
"massActions": {
"delete": {
"allowed": true
},
"update": {
"allowed": true
}
}
}
@@ -0,0 +1,10 @@
{
"massActions": {
"update": {
"allowed": true
},
"delete": {
"allowed": true
}
}
}
@@ -4,5 +4,10 @@
],
"listLoaderClassNameList": [
"Espo\\Classes\\FieldProcessing\\Portal\\UrlLoader"
]
],
"massActions": {
"delete": {
"allowed": true
}
}
}
@@ -0,0 +1,7 @@
{
"massActions": {
"delete": {
"allowed": true
}
}
}
@@ -0,0 +1,7 @@
{
"massActions": {
"delete": {
"allowed": true
}
}
}
@@ -0,0 +1,10 @@
{
"massActions": {
"delete": {
"allowed": true
},
"update": {
"allowed": true
}
}
}
@@ -0,0 +1,7 @@
{
"massActions": {
"delete": {
"allowed": true
}
}
}
@@ -0,0 +1,10 @@
{
"massActions": {
"delete": {
"allowed": true
},
"update": {
"allowed": true
}
}
}
@@ -0,0 +1,10 @@
{
"massActions": {
"delete": {
"allowed": true
},
"update": {
"allowed": true
}
}
}
@@ -0,0 +1,37 @@
/************************************************************************
* This file is part of EspoCRM.
*
* EspoCRM - Open Source CRM application.
* Copyright (C) 2014-2021 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
* Website: https://www.espocrm.com
*
* EspoCRM is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* EspoCRM is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
*
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
define('views/dashboard-template/record/list', 'views/record/list', function (Dep) {
return Dep.extend({
massActionList: ['remove', 'export'],
});
});
@@ -0,0 +1,38 @@
/************************************************************************
* This file is part of EspoCRM.
*
* EspoCRM - Open Source CRM application.
* Copyright (C) 2014-2021 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
* Website: https://www.espocrm.com
*
* EspoCRM is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* EspoCRM is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
*
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
define('views/email-filter/record/list', 'views/record/list', function (Dep) {
return Dep.extend({
massActionList: ['remove', 'massUpdate', 'export']
});
});
@@ -0,0 +1,40 @@
/************************************************************************
* This file is part of EspoCRM.
*
* EspoCRM - Open Source CRM application.
* Copyright (C) 2014-2021 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
* Website: https://www.espocrm.com
*
* EspoCRM is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* EspoCRM is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
*
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
define('views/layout-set/record/list', 'views/record/list', function (Dep) {
return Dep.extend({
massActionList: [
'remove',
'export',
],
});
});
@@ -0,0 +1,36 @@
/************************************************************************
* This file is part of EspoCRM.
*
* EspoCRM - Open Source CRM application.
* Copyright (C) 2014-2021 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
* Website: https://www.espocrm.com
*
* EspoCRM is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* EspoCRM is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
*
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
define('views/lead-capture/record/list', 'views/record/list', function (Dep) {
return Dep.extend({
massActionList: ['remove', 'massUpdate', 'export'],
});
});
+39
View File
@@ -0,0 +1,39 @@
/************************************************************************
* This file is part of EspoCRM.
*
* EspoCRM - Open Source CRM application.
* Copyright (C) 2014-2021 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
* Website: https://www.espocrm.com
*
* EspoCRM is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* EspoCRM is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
*
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
define('views/portal/record/list', 'views/record/list', function (Dep) {
return Dep.extend({
massActionList: [
'remove',
],
});
});
+37
View File
@@ -0,0 +1,37 @@
/************************************************************************
* This file is part of EspoCRM.
*
* EspoCRM - Open Source CRM application.
* Copyright (C) 2014-2021 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
* Website: https://www.espocrm.com
*
* EspoCRM is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* EspoCRM is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
*
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
define('views/webhook/record/list', 'views/record/list', function (Dep) {
return Dep.extend({
massActionList: ['remove', 'massUpdate', 'export'],
});
});