mirror of
https://github.com/espocrm/espocrm.git
synced 2026-06-28 06:56:05 +00:00
Portal Roles
This commit is contained in:
@@ -41,9 +41,13 @@ use \Espo\Core\Utils\File\Manager as FileManager;
|
||||
|
||||
class Table
|
||||
{
|
||||
protected $type = 'acl';
|
||||
|
||||
protected $defaultAclType = 'recordAllTeamOwnNo';
|
||||
|
||||
private $data = null;
|
||||
|
||||
private $cacheFile;
|
||||
protected $cacheFilePath;
|
||||
|
||||
protected $actionList = ['read', 'stream', 'edit', 'delete'];
|
||||
|
||||
@@ -53,6 +57,8 @@ class Table
|
||||
|
||||
protected $fieldLevelList = ['yes', 'no'];
|
||||
|
||||
protected $valuePermissionList = ['assignmentPermission', 'userPermission'];
|
||||
|
||||
private $fileManager;
|
||||
|
||||
private $metadata;
|
||||
@@ -88,11 +94,12 @@ class Table
|
||||
if ($fileManager) {
|
||||
$this->fileManager = $fileManager;
|
||||
}
|
||||
$this->valuePermissionList = $this->metadata->get('app.' . $this->type . '.defs.valuePermissionList', $this->valuePermissionList);
|
||||
|
||||
$this->cacheFile = 'data/cache/application/acl/' . $user->id . '.php';
|
||||
$this->initCacheFilePath();
|
||||
|
||||
if ($config && $config->get('useCache') && file_exists($this->cacheFile)) {
|
||||
$cached = include $this->cacheFile;
|
||||
if ($config && $config->get('useCache') && file_exists($this->cacheFilePath)) {
|
||||
$cached = include $this->cacheFilePath;
|
||||
$this->data = $cached;
|
||||
} else {
|
||||
$this->load();
|
||||
@@ -102,6 +109,11 @@ class Table
|
||||
}
|
||||
}
|
||||
|
||||
protected function initCacheFilePath()
|
||||
{
|
||||
$this->cacheFilePath = 'data/cache/application/acl/' . $this->user->id . '.php';
|
||||
}
|
||||
|
||||
protected function getMetadata()
|
||||
{
|
||||
return $this->metadata;
|
||||
@@ -161,8 +173,11 @@ class Table
|
||||
{
|
||||
$aclTableList = [];
|
||||
$fieldTableList = [];
|
||||
$assignmentPermissionList = [];
|
||||
$userPermissionList = [];
|
||||
|
||||
$valuePermissionLists = (object)[];
|
||||
foreach ($this->valuePermissionList as $permission) {
|
||||
$valuePermissionLists->$permission = [];
|
||||
}
|
||||
|
||||
if (!$this->user->isAdmin()) {
|
||||
$userRoles = $this->user->get('roles');
|
||||
@@ -170,8 +185,9 @@ class Table
|
||||
foreach ($userRoles as $role) {
|
||||
$aclTableList[] = $role->get('data');
|
||||
$fieldTableList[] = $role->get('fieldData');
|
||||
$assignmentPermissionList[] = $role->get('assignmentPermission');
|
||||
$userPermissionList[] = $role->get('userPermission');
|
||||
foreach ($this->valuePermissionList as $permission) {
|
||||
$valuePermissionLists->{$permission}[] = $role->get($permission);
|
||||
}
|
||||
}
|
||||
|
||||
$teams = $this->user->get('teams');
|
||||
@@ -180,8 +196,9 @@ class Table
|
||||
foreach ($teamRoles as $role) {
|
||||
$aclTableList[] = $role->get('data');
|
||||
$fieldTableList[] = $role->get('fieldData');
|
||||
$assignmentPermissionList[] = $role->get('assignmentPermission');
|
||||
$userPermissionList[] = $role->get('userPermission');
|
||||
foreach ($this->valuePermissionList as $permission) {
|
||||
$valuePermissionLists->{$permission}[] = $role->get($permission);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -189,14 +206,7 @@ class Table
|
||||
$fieldTable = $this->mergeFieldTableList($fieldTableList);
|
||||
|
||||
$this->applyDefault($aclTable, $fieldTable);
|
||||
|
||||
foreach ($this->getScopeList() as $scope) {
|
||||
if ($this->metadata->get('scopes.' . $scope . '.disabled')) {
|
||||
$aclTable->$scope = false;
|
||||
unset($fieldTable->$scope);
|
||||
}
|
||||
}
|
||||
|
||||
$this->applyDisabled($aclTable, $fieldTable);
|
||||
$this->applyMandatory($aclTable, $fieldTable);
|
||||
} else {
|
||||
$aclTable = (object) [];
|
||||
@@ -229,18 +239,17 @@ class Table
|
||||
$this->fillFieldTableQuickAccess();
|
||||
|
||||
if (!$this->user->isAdmin()) {
|
||||
$this->data->assignmentPermission = $this->mergeValueList($assignmentPermissionList, $this->metadata->get('app.acl.default.assignmentPermission', 'all'));
|
||||
$this->data->userPermission = $this->mergeValueList($userPermissionList, $this->metadata->get('app.acl.default.userPermission', 'no'));
|
||||
foreach ($this->valuePermissionList as $permission) {
|
||||
$this->data->$permission = $this->mergeValueList($valuePermissionLists->$permission, $this->metadata->get('app.acl.default.' . $permission, 'all'));
|
||||
if ($this->metadata->get('app.acl.mandatory.' . $permission)) {
|
||||
$this->data->$permission = $this->metadata->get('app.acl.mandatory.' . $permission);
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->metadata->get('app.acl.mandatory.assignmentPermission')) {
|
||||
$this->data->assignmentPermission = $this->metadata->get('app.acl.mandatory.assignmentPermission');
|
||||
}
|
||||
if ($this->metadata->get('app.acl.mandatory.userPermission')) {
|
||||
$this->data->userPermission = $this->metadata->get('app.acl.mandatory.userPermission');
|
||||
}
|
||||
} else {
|
||||
$this->data->assignmentPermission = 'all';
|
||||
$this->data->userPermission = 'all';
|
||||
foreach ($this->valuePermissionList as $permission) {
|
||||
$this->data->$permission = 'all';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -359,10 +368,6 @@ class Table
|
||||
|
||||
protected function applyDefault(&$table, &$fieldTable)
|
||||
{
|
||||
if (!$this->metadata) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($this->user->isAdmin()) {
|
||||
return;
|
||||
}
|
||||
@@ -381,7 +386,9 @@ class Table
|
||||
$fieldData = $this->metadata->get('app.acl.default.fieldLevel', array());
|
||||
|
||||
foreach ($fieldData as $scope => $s) {
|
||||
$fieldList = array_keys($this->getMetadata()->get("entityDefs.{$scope}.fields", []));
|
||||
foreach ($s as $field => $f) {
|
||||
if (!in_array($field, $fieldList)) continue;
|
||||
if (!isset($fieldTable->$scope)) {
|
||||
$fieldTable->$scope = (object) [];
|
||||
}
|
||||
@@ -399,9 +406,9 @@ class Table
|
||||
|
||||
foreach ($this->getScopeWithAclList() as $scope) {
|
||||
if (!isset($table->$scope)) {
|
||||
$aclType = $this->metadata->get('scopes.' . $scope . '.acl');
|
||||
$aclType = $this->metadata->get('scopes.' . $scope . '.' . $this->type);
|
||||
if ($aclType === true) {
|
||||
$aclType = 'recordAllTeamOwnNo';
|
||||
$aclType = $this->defaultAclType;
|
||||
}
|
||||
if (!empty($aclType)) {
|
||||
$defaultValue = $this->metadata->get('app.acl.scopeLevelTypesDefaults.' . $aclType, true);
|
||||
@@ -416,10 +423,6 @@ class Table
|
||||
|
||||
protected function applyMandatory(&$table, &$fieldTable)
|
||||
{
|
||||
if (!$this->metadata) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($this->user->isAdmin()) {
|
||||
return;
|
||||
}
|
||||
@@ -437,10 +440,12 @@ class Table
|
||||
$fieldData = $this->metadata->get('app.acl.mandatory.fieldLevel', array());
|
||||
|
||||
foreach ($fieldData as $scope => $s) {
|
||||
$fieldList = array_keys($this->getMetadata()->get("entityDefs.{$scope}.fields", []));
|
||||
if (!isset($fieldTable->$scope)) {
|
||||
$fieldTable->$scope = (object) [];
|
||||
}
|
||||
foreach ($s as $field => $f) {
|
||||
if (!in_array($field, $fieldList)) continue;
|
||||
$fieldTable->$scope->$field = (object) [];
|
||||
foreach ($this->fieldActionList as $action) {
|
||||
$level = 'no';
|
||||
@@ -453,6 +458,20 @@ class Table
|
||||
}
|
||||
}
|
||||
|
||||
protected function applyDisabled(&$table, &$fieldTable)
|
||||
{
|
||||
if ($this->user->isAdmin()) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($this->getScopeList() as $scope) {
|
||||
if ($this->getMetadata()->get('scopes.' . $scope . '.disabled')) {
|
||||
$aclTable->$scope = false;
|
||||
unset($fieldTable->$scope);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function mergeValueList(array $list, $defaultValue)
|
||||
{
|
||||
$result = null;
|
||||
@@ -478,9 +497,8 @@ class Table
|
||||
$scopeList = [];
|
||||
$scopes = $this->metadata->get('scopes');
|
||||
foreach ($scopes as $scope => $d) {
|
||||
if (!empty($d['acl'])) {
|
||||
$scopeList[] = $scope;
|
||||
}
|
||||
if (empty($d['acl'])) continue;
|
||||
$scopeList[] = $scope;
|
||||
}
|
||||
return $scopeList;
|
||||
}
|
||||
@@ -564,9 +582,13 @@ class Table
|
||||
|
||||
if (!is_object($table->$scope)) continue;
|
||||
|
||||
$fieldList = array_keys($this->getMetadata()->get("entityDefs.{$scope}.fields", []));
|
||||
|
||||
foreach (get_object_vars($table->$scope) as $field => $row) {
|
||||
if (!is_object($row)) continue;
|
||||
|
||||
if (!in_array($field, $fieldList)) continue;
|
||||
|
||||
if (!isset($data->$scope->$field)) {
|
||||
$data->$scope->$field = (object) [];
|
||||
}
|
||||
@@ -593,7 +615,7 @@ class Table
|
||||
private function buildCache()
|
||||
{
|
||||
$contents = '<' . '?'. 'php return ' . $this->varExport($this->data) . ';';
|
||||
$this->fileManager->putContents($this->cacheFile, $contents);
|
||||
$this->fileManager->putContents($this->cacheFilePath, $contents);
|
||||
}
|
||||
|
||||
private function varExport($variable)
|
||||
|
||||
84
application/Espo/Core/Acl/TablePortal.php
Normal file
84
application/Espo/Core/Acl/TablePortal.php
Normal file
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://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.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core\Acl;
|
||||
|
||||
use \Espo\Core\Exceptions\Error;
|
||||
|
||||
use \Espo\ORM\Entity;
|
||||
use \Espo\Entities\User;
|
||||
|
||||
use \Espo\Core\Utils\Config;
|
||||
use \Espo\Core\Utils\Metadata;
|
||||
use \Espo\Core\Utils\FieldManager;
|
||||
use \Espo\Core\Utils\File\Manager as FileManager;
|
||||
|
||||
class TablePortal extends Table
|
||||
{
|
||||
protected $type = 'aclPortal';
|
||||
|
||||
protected $defaultAclType = 'recordAllOwnNo';
|
||||
|
||||
protected $valuePermissionList = [];
|
||||
|
||||
protected function getScopeWithAclList()
|
||||
{
|
||||
$scopeList = [];
|
||||
$scopes = $this->metadata->get('scopes');
|
||||
foreach ($scopes as $scope => $d) {
|
||||
if (empty($d['acl'])) continue;
|
||||
if (empty($d['aclPortal'])) continue;
|
||||
$scopeList[] = $scope;
|
||||
}
|
||||
return $scopeList;
|
||||
}
|
||||
|
||||
protected function applyDefault(&$table, &$fieldTable)
|
||||
{
|
||||
parent::applyDefault($table, $fieldTable);
|
||||
|
||||
foreach ($this->getScopeList() as $scope) {
|
||||
if (!isset($table->$scope)) {
|
||||
$table->$scope = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function applyDisabled(&$table, &$fieldTable)
|
||||
{
|
||||
foreach ($this->getScopeList() as $scope) {
|
||||
$d = $this->getMetadata()->get('scopes.' . $scope);
|
||||
if ($d['disabled'] || $d['portalDisabled']) {
|
||||
$aclTable->$scope = false;
|
||||
unset($fieldTable->$scope);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
"layouts": true,
|
||||
"tab": true,
|
||||
"acl": true,
|
||||
"aclPortal": true,
|
||||
"customizable": true,
|
||||
"importable": true,
|
||||
"notifications": true
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
"layouts": true,
|
||||
"tab": true,
|
||||
"acl": true,
|
||||
"aclPortal": true,
|
||||
"customizable": true,
|
||||
"importable": false,
|
||||
"notifications": false
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
"layouts": true,
|
||||
"tab": true,
|
||||
"acl": true,
|
||||
"aclPortal": true,
|
||||
"customizable": true,
|
||||
"importable": true,
|
||||
"notifications": true
|
||||
|
||||
@@ -1 +1,3 @@
|
||||
[{"name":"name","link":true,"width":"30"}]
|
||||
[
|
||||
{"name":"name", "link":true}
|
||||
]
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
"layouts": true,
|
||||
"tab": true,
|
||||
"acl": true,
|
||||
"aclPortal": "recordAllOwnNo",
|
||||
"module": "Crm",
|
||||
"customizable": true,
|
||||
"stream": true,
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
"layouts": true,
|
||||
"tab": true,
|
||||
"acl": true,
|
||||
"aclPortal": "recordAllAccountOwnNo",
|
||||
"module": "Crm",
|
||||
"customizable": true,
|
||||
"importable": true,
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
"layouts": true,
|
||||
"tab": true,
|
||||
"acl": true,
|
||||
"aclPortal": "recordAllAccountOwnNo",
|
||||
"module": "Crm",
|
||||
"customizable": true,
|
||||
"stream": true,
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
"layouts":true,
|
||||
"tab":true,
|
||||
"acl":true,
|
||||
"aclPortal": "recordAllAccountOwnNo",
|
||||
"module":"Crm",
|
||||
"customizable": true,
|
||||
"stream": true,
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
"layouts": true,
|
||||
"tab": true,
|
||||
"acl": true,
|
||||
"aclPortal": "recordAllAccountOwnNo",
|
||||
"module": "Crm",
|
||||
"customizable": true,
|
||||
"importable": false,
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
"layouts": true,
|
||||
"tab": true,
|
||||
"acl": true,
|
||||
"aclPortal": "recordAllOwnNo",
|
||||
"module": "Crm",
|
||||
"customizable": true,
|
||||
"stream": true,
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
"layouts": true,
|
||||
"tab": true,
|
||||
"acl": true,
|
||||
"aclPortal": "recordAllAccountOwnNo",
|
||||
"module": "Crm",
|
||||
"customizable": true,
|
||||
"importable": true,
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
"layouts": true,
|
||||
"tab": true,
|
||||
"acl": true,
|
||||
"aclPortal": "recordAllAccountOwnNo",
|
||||
"module": "Crm",
|
||||
"customizable": true,
|
||||
"stream": true,
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
"layouts": true,
|
||||
"tab": true,
|
||||
"acl": true,
|
||||
"aclPortal": "recordAllAccountOwnNo",
|
||||
"module": "Crm",
|
||||
"customizable": true,
|
||||
"importable": true,
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
"Rebuild": "Rebuild",
|
||||
"Teams": "Teams",
|
||||
"Roles": "Roles",
|
||||
"Potal": "Portal",
|
||||
"Portals": "Portals",
|
||||
"Portal Roles": "Portal Roles",
|
||||
"Outbound Emails": "Outbound Emails",
|
||||
"Group Email Accounts": "Group Email Accounts",
|
||||
"Personal Email Accounts": "Personal Email Accounts",
|
||||
@@ -149,6 +152,8 @@
|
||||
"users": "Users management.",
|
||||
"teams": "Teams management.",
|
||||
"roles": "Roles management.",
|
||||
"portals": "Portals management.",
|
||||
"portalRoles": "Roles for portal.",
|
||||
"outboundEmails": "SMTP settings for outgoing emails.",
|
||||
"groupEmailAccounts": "Group IMAP email accounts. Email import and Email-to-Case.",
|
||||
"personalEmailAccounts": "Users email accounts.",
|
||||
|
||||
@@ -18,7 +18,8 @@
|
||||
"Template": "Template",
|
||||
"Job": "Job",
|
||||
"EmailFilter": "Email Filter",
|
||||
"Portal": "Portal"
|
||||
"Portal": "Portal",
|
||||
"PortalRole": "Portal Role"
|
||||
},
|
||||
"scopeNamesPlural": {
|
||||
"Email": "Emails",
|
||||
@@ -39,7 +40,8 @@
|
||||
"Template": "Templates",
|
||||
"Job": "Jobs",
|
||||
"EmailFilter": "Email Filters",
|
||||
"Portal": "Portals"
|
||||
"Portal": "Portals",
|
||||
"PortalRole": "Portal Roles"
|
||||
},
|
||||
"labels": {
|
||||
"Misc": "Misc",
|
||||
|
||||
15
application/Espo/Resources/i18n/en_US/PortalRole.json
Normal file
15
application/Espo/Resources/i18n/en_US/PortalRole.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"fields": {
|
||||
},
|
||||
"links": {
|
||||
"users": "Users"
|
||||
},
|
||||
"tooltips": {
|
||||
},
|
||||
"labels": {
|
||||
"Access": "Access",
|
||||
"Create PortalRole": "Create Portal Role",
|
||||
"Scope Level": "Scope Level",
|
||||
"Field Level": "Field Level"
|
||||
}
|
||||
}
|
||||
@@ -28,6 +28,7 @@
|
||||
"levelList": {
|
||||
"all": "all",
|
||||
"team": "team",
|
||||
"account": "account",
|
||||
"own": "own",
|
||||
"no": "no",
|
||||
"yes": "yes",
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
"User": {
|
||||
"read": "all",
|
||||
"edit": "no",
|
||||
"delete": "no"
|
||||
"delete": "no",
|
||||
"stream": "no"
|
||||
},
|
||||
"Team": {
|
||||
"read": "all",
|
||||
|
||||
81
application/Espo/Resources/metadata/app/aclPortal.json
Normal file
81
application/Espo/Resources/metadata/app/aclPortal.json
Normal file
@@ -0,0 +1,81 @@
|
||||
{
|
||||
"mandatory": {
|
||||
"scopeLevel": {
|
||||
"User": {
|
||||
"read": "no",
|
||||
"edit": "no",
|
||||
"delete": "no",
|
||||
"stream": "no"
|
||||
},
|
||||
"Team": {
|
||||
"read": "no",
|
||||
"edit": "no",
|
||||
"delete": "no"
|
||||
},
|
||||
"Note": {
|
||||
"read": "own",
|
||||
"edit": "own",
|
||||
"delete": "own"
|
||||
},
|
||||
"Portal": false,
|
||||
"EmailAddress": false,
|
||||
"Attachment": {
|
||||
"read": "own",
|
||||
"edit": "own",
|
||||
"delete": "own"
|
||||
},
|
||||
"PhoneNumber": false,
|
||||
"EmailAccount": {
|
||||
"read": "own",
|
||||
"edit": "own",
|
||||
"delete": "own"
|
||||
},
|
||||
"Role": false,
|
||||
"PortalRole": false,
|
||||
"EmailFilter": false,
|
||||
"EmailAccount": false,
|
||||
"EmailTemplate": false
|
||||
}
|
||||
},
|
||||
"default": {
|
||||
"scopeLevel": {
|
||||
},
|
||||
"fieldLevel": {
|
||||
"assignedUser": {
|
||||
"read": "yes",
|
||||
"edit": "no"
|
||||
},
|
||||
"assignedUsers": {
|
||||
"read": "yes",
|
||||
"edit": "no"
|
||||
},
|
||||
"teams": {
|
||||
"read": "yes",
|
||||
"edit": "no"
|
||||
}
|
||||
}
|
||||
},
|
||||
"scopeLevelTypesDefaults": {
|
||||
"boolean": false,
|
||||
"recordAllAccountOwnNo": {
|
||||
"read": "no",
|
||||
"edit": "no",
|
||||
"delete": "no"
|
||||
},
|
||||
"recordAllOwnNo": {
|
||||
"read": "no",
|
||||
"edit": "no",
|
||||
"delete": "no"
|
||||
},
|
||||
"recordAllAccountNo": {
|
||||
"read": "no",
|
||||
"edit": "no",
|
||||
"delete": "no"
|
||||
},
|
||||
"recordAllNo": {
|
||||
"read": "no",
|
||||
"edit": "no",
|
||||
"delete": "no"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -74,6 +74,21 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"portal": {
|
||||
"label":"Portal",
|
||||
"items":[
|
||||
{
|
||||
"url":"#Portal",
|
||||
"label":"Portals",
|
||||
"description":"portals"
|
||||
},
|
||||
{
|
||||
"url":"#PortalRole",
|
||||
"label":"Portal Roles",
|
||||
"description":"portalRoles"
|
||||
}
|
||||
]
|
||||
},
|
||||
"email":{
|
||||
"label":"Email",
|
||||
"items":[
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"recordViews": {
|
||||
"detail":"views/portal-role/record/detail",
|
||||
"edit":"views/portal-role/record/edit",
|
||||
"editQuick":"views/portal-role/record/edit",
|
||||
"list":"views/portal-role/record/list"
|
||||
},
|
||||
"relationshipPanels": {
|
||||
"users": {
|
||||
"create":false,
|
||||
"rowActionsView": "views/record/row-actions/relationship-unlink-only"
|
||||
}
|
||||
},
|
||||
"views": {
|
||||
"list": "views/portal-role/list"
|
||||
}
|
||||
}
|
||||
@@ -1,21 +1,21 @@
|
||||
{
|
||||
"recordViews":{
|
||||
"detail":"Role.Record.Detail",
|
||||
"edit":"Role.Record.Edit",
|
||||
"editQuick":"Role.Record.Edit",
|
||||
"list":"Role.Record.List"
|
||||
},
|
||||
"relationshipPanels":{
|
||||
"users":{
|
||||
"create":false,
|
||||
"rowActionsView": "Record.RowActions.RelationshipUnlinkOnly"
|
||||
},
|
||||
"teams":{
|
||||
"create":false,
|
||||
"rowActionsView": "Record.RowActions.RelationshipUnlinkOnly"
|
||||
}
|
||||
},
|
||||
"views": {
|
||||
"list": "Role.List"
|
||||
}
|
||||
"recordViews":{
|
||||
"detail":"views/role/record/detail",
|
||||
"edit":"views/role/record/edit",
|
||||
"editQuick":"views/role/record/edit",
|
||||
"list":"views/role/record/list"
|
||||
},
|
||||
"relationshipPanels": {
|
||||
"users":{
|
||||
"create":false,
|
||||
"rowActionsView": "views/record/row-actions/relationship-unlink-only"
|
||||
},
|
||||
"teams":{
|
||||
"create":false,
|
||||
"rowActionsView": "views/record/row-actions/relationship-unlink-only"
|
||||
}
|
||||
},
|
||||
"views": {
|
||||
"list": "views/role/list"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
"layouts": false,
|
||||
"tab": true,
|
||||
"acl": true,
|
||||
"aclPortal": "recordAllAccountOwnNo",
|
||||
"notifications": true,
|
||||
"object": true,
|
||||
"customizable": true
|
||||
|
||||
58
application/Espo/Services/PortalRole.php
Normal file
58
application/Espo/Services/PortalRole.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://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.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Services;
|
||||
|
||||
use \Espo\ORM\Entity;
|
||||
|
||||
class PortalRole extends Record
|
||||
{
|
||||
protected function init()
|
||||
{
|
||||
$this->dependencies[] = 'fileManager';
|
||||
}
|
||||
|
||||
public function afterCreate(Entity $entity, array $data)
|
||||
{
|
||||
parent::afterCreate($entity, $data);
|
||||
$this->clearRolesCache();
|
||||
}
|
||||
|
||||
public function afterUpdate(Entity $entity, array $data)
|
||||
{
|
||||
parent::afterUpdate($entity, $data);
|
||||
$this->clearRolesCache();
|
||||
}
|
||||
|
||||
protected function clearRolesCache()
|
||||
{
|
||||
$this->getInjection('fileManager')->removeInDir('data/cache/application/acl/portal');
|
||||
}
|
||||
}
|
||||
|
||||
42
frontend/client/src/controllers/portal-role.js
Normal file
42
frontend/client/src/controllers/portal-role.js
Normal file
@@ -0,0 +1,42 @@
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://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.
|
||||
************************************************************************/
|
||||
|
||||
Espo.define('controllers/portal-role', 'controllers/record', function (Dep) {
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
checkAccess: function () {
|
||||
if (this.getUser().isAdmin()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
36
frontend/client/src/views/portal-role/list.js
Normal file
36
frontend/client/src/views/portal-role/list.js
Normal file
@@ -0,0 +1,36 @@
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://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.
|
||||
************************************************************************/
|
||||
|
||||
Espo.define('views/portal-role/list', 'views/list', function (Dep) {
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
searchPanel: false
|
||||
|
||||
});
|
||||
});
|
||||
36
frontend/client/src/views/portal-role/record/detail.js
Normal file
36
frontend/client/src/views/portal-role/record/detail.js
Normal file
@@ -0,0 +1,36 @@
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://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.
|
||||
************************************************************************/
|
||||
|
||||
Espo.define('views/portal-role/record/detail', 'views/role/record/detail', function (Dep) {
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
tableView: 'views/portal-role/record/table',
|
||||
|
||||
});
|
||||
});
|
||||
38
frontend/client/src/views/portal-role/record/edit.js
Normal file
38
frontend/client/src/views/portal-role/record/edit.js
Normal file
@@ -0,0 +1,38 @@
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://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.
|
||||
************************************************************************/
|
||||
|
||||
Espo.define('views/portal-role/record/edit', 'views/role/record/edit', function (Dep) {
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
tableView: 'views/portal-role/record/table',
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
37
frontend/client/src/views/portal-role/record/list.js
Normal file
37
frontend/client/src/views/portal-role/record/list.js
Normal file
@@ -0,0 +1,37 @@
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://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.
|
||||
************************************************************************/
|
||||
|
||||
Espo.define('views/portal-role/record/list', 'views/role/record/list', function (Dep) {
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
67
frontend/client/src/views/portal-role/record/table.js
Normal file
67
frontend/client/src/views/portal-role/record/table.js
Normal file
@@ -0,0 +1,67 @@
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://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.
|
||||
************************************************************************/
|
||||
|
||||
Espo.define('views/portal-role/record/table', 'views/role/record/table', function (Dep) {
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
levelListMap: {
|
||||
'recordAllAccountOwnNo': ['all', 'account', 'own', 'no'],
|
||||
'recordAllAccountNo': ['all', 'account', 'no'],
|
||||
'recordAllOwnNo': ['all', 'own', 'no'],
|
||||
'recordAllNo': ['all', 'no'],
|
||||
'record': ['all', 'own', 'no']
|
||||
},
|
||||
|
||||
levelList: ['all', 'account', 'own', 'no'],
|
||||
|
||||
setupScopeList: function () {
|
||||
this.aclTypeMap = {};
|
||||
this.scopeList = [];
|
||||
|
||||
var scopeListAll = Object.keys(this.getMetadata().get('scopes')).sort(function (v1, v2) {
|
||||
return this.translate(v1, 'scopeNamesPlural').localeCompare(this.translate(v2, 'scopeNamesPlural'));
|
||||
}.bind(this));
|
||||
|
||||
scopeListAll.forEach(function (scope) {
|
||||
if (this.getMetadata().get('scopes.' + scope + '.disabled') || this.getMetadata().get('scopes.' + scope + '.disabledPortal')) return;
|
||||
var acl = this.getMetadata().get('scopes.' + scope + '.aclPortal');
|
||||
if (acl) {
|
||||
this.scopeList.push(scope);
|
||||
this.aclTypeMap[scope] = acl;
|
||||
if (acl === true) {
|
||||
this.aclTypeMap[scope] = 'recordAllOwnNo';
|
||||
}
|
||||
}
|
||||
}, this);
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -24,18 +24,13 @@
|
||||
*
|
||||
* 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.
|
||||
************************************************************************/
|
||||
Espo.define('Views.Role.List', 'Views.List', function (Dep) {
|
||||
************************************************************************/
|
||||
Espo.define('views/role/list', 'views/list', function (Dep) {
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
searchPanel: false
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
searchPanel: false,
|
||||
|
||||
setup: function () {
|
||||
Dep.prototype.setup.call(this);
|
||||
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
Espo.define('Views.Role.Record.DetailSide', 'Views.Record.DetailSide', function (Dep) {
|
||||
Espo.define('views/role/record/detail-side', 'views/record/detail-side', function (Dep) {
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
@@ -34,7 +34,7 @@ Espo.define('Views.Role.Record.DetailSide', 'Views.Record.DetailSide', function
|
||||
{
|
||||
name: 'default',
|
||||
label: false,
|
||||
view: 'Role.Record.Panels.Side'
|
||||
view: 'views/role/record/panels/side'
|
||||
}
|
||||
],
|
||||
|
||||
|
||||
@@ -30,31 +30,15 @@ Espo.define('views/role/record/detail', 'views/record/detail', function (Dep) {
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
tableView: 'views/role/record/table',
|
||||
|
||||
sideView: 'views/role/record/detail-side',
|
||||
|
||||
editModeDisabled: true,
|
||||
|
||||
getDetailLayout: function (callback) {
|
||||
var simpleLayout = [
|
||||
{
|
||||
label: '',
|
||||
cells: [
|
||||
{
|
||||
name: 'name',
|
||||
type: 'base',
|
||||
},
|
||||
]
|
||||
}
|
||||
];
|
||||
callback({
|
||||
type: 'record',
|
||||
layout: this._convertSimplifiedLayout(simpleLayout)
|
||||
});
|
||||
},
|
||||
|
||||
setup: function () {
|
||||
Dep.prototype.setup.call(this);
|
||||
this.createView('extra', 'views/role/record/table', {
|
||||
this.createView('extra', this.tableView, {
|
||||
acl: {
|
||||
data: this.model.get('data') || {},
|
||||
fieldData: this.model.get('fieldData') || {}
|
||||
|
||||
@@ -30,6 +30,8 @@ Espo.define('views/role/record/edit', 'views/record/edit', function (Dep) {
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
tableView: 'views/role/record/table',
|
||||
|
||||
sideView: 'views/role/record/detail-side',
|
||||
|
||||
events: _.extend({
|
||||
@@ -101,7 +103,7 @@ Espo.define('views/role/record/edit', 'views/record/edit', function (Dep) {
|
||||
setup: function () {
|
||||
Dep.prototype.setup.call(this);
|
||||
|
||||
this.createView('extra', 'views/role/record/table', {
|
||||
this.createView('extra', this.tableView, {
|
||||
mode: 'edit',
|
||||
acl: {
|
||||
data: this.model.get('data') || {},
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
Espo.define('Views.Role.Record.List', 'Views.Record.List', function (Dep) {
|
||||
Espo.define('views/role/record/list', 'views/record/list', function (Dep) {
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
|
||||
@@ -24,13 +24,13 @@
|
||||
*
|
||||
* 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.
|
||||
************************************************************************/
|
||||
************************************************************************/
|
||||
|
||||
Espo.define('Views.Role.Record.Panels.Side', 'Views.Record.Panels.Side', function (Dep) {
|
||||
Espo.define('views/role/record/panels/side', 'views/record/panels/side', function (Dep) {
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
template: 'role.record.panels.side',
|
||||
template: 'role/record/panels/side',
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
@@ -50,9 +50,12 @@ Espo.define('views/role/record/table', 'view', function (Dep) {
|
||||
'record': ['all', 'team', 'own', 'no']
|
||||
},
|
||||
|
||||
levelList: ['all', 'team', 'own', 'no'],
|
||||
|
||||
colors: {
|
||||
yes: '#6BC924',
|
||||
all: '#6BC924',
|
||||
account: '#999900',
|
||||
team: '#999900',
|
||||
own: '#CC9900',
|
||||
no: '#F23333',
|
||||
@@ -172,8 +175,24 @@ Espo.define('views/role/record/table', 'view', function (Dep) {
|
||||
|
||||
this.final = this.options.final || false;
|
||||
|
||||
this.aclTypeMap = {};
|
||||
this.setupScopeList();
|
||||
|
||||
this.listenTo(this.model, 'sync', function () {
|
||||
if (this.isRendered()) {
|
||||
this.reRender();
|
||||
}
|
||||
}, this);
|
||||
|
||||
this.setupFieldTableDataList();
|
||||
|
||||
this.template = 'role/table';
|
||||
if (this.mode == 'edit') {
|
||||
this.template = 'role/table-edit';
|
||||
}
|
||||
},
|
||||
|
||||
setupScopeList: function () {
|
||||
this.aclTypeMap = {};
|
||||
this.scopeList = [];
|
||||
|
||||
var scopeListAll = Object.keys(this.getMetadata().get('scopes')).sort(function (v1, v2) {
|
||||
@@ -191,19 +210,6 @@ Espo.define('views/role/record/table', 'view', function (Dep) {
|
||||
}
|
||||
}
|
||||
}, this);
|
||||
|
||||
this.listenTo(this.model, 'sync', function () {
|
||||
if (this.isRendered()) {
|
||||
this.reRender();
|
||||
}
|
||||
}, this);
|
||||
|
||||
this.setupFieldTableDataList();
|
||||
|
||||
this.template = 'role/table';
|
||||
if (this.mode == 'edit') {
|
||||
this.template = 'role/table-edit';
|
||||
}
|
||||
},
|
||||
|
||||
setupFieldTableDataList: function () {
|
||||
@@ -339,14 +345,14 @@ Espo.define('views/role/record/table', 'view', function (Dep) {
|
||||
var $edit = this.$el.find('select[name="'+scope+'-edit"]');
|
||||
|
||||
if (!dontChange) {
|
||||
if (this.levelListMap.record.indexOf($edit.val()) < this.levelListMap.record.indexOf(value)) {
|
||||
if (this.levelList.indexOf($edit.val()) < this.levelList.indexOf(value)) {
|
||||
$edit.val(value);
|
||||
}
|
||||
}
|
||||
|
||||
$edit.find('option').each(function (i, o) {
|
||||
var $o = $(o);
|
||||
if (this.levelListMap.record.indexOf($o.val()) < this.levelListMap.record.indexOf(value)) {
|
||||
if (this.levelList.indexOf($o.val()) < this.levelList.indexOf(value)) {
|
||||
$o.attr('disabled', 'disabled');
|
||||
} else {
|
||||
$o.removeAttr('disabled');
|
||||
@@ -358,14 +364,14 @@ Espo.define('views/role/record/table', 'view', function (Dep) {
|
||||
var $stream = this.$el.find('select[name="'+scope+'-stream"]');
|
||||
|
||||
if (!dontChange) {
|
||||
if (this.levelListMap.record.indexOf($stream.val()) < this.levelListMap.record.indexOf(value)) {
|
||||
if (this.levelList.indexOf($stream.val()) < this.levelList.indexOf(value)) {
|
||||
$stream.val(value);
|
||||
}
|
||||
}
|
||||
|
||||
$stream.find('option').each(function (i, o) {
|
||||
var $o = $(o);
|
||||
if (this.levelListMap.record.indexOf($o.val()) < this.levelListMap.record.indexOf(value)) {
|
||||
if (this.levelList.indexOf($o.val()) < this.levelList.indexOf(value)) {
|
||||
$o.attr('disabled', 'disabled');
|
||||
} else {
|
||||
$o.removeAttr('disabled');
|
||||
@@ -377,14 +383,14 @@ Espo.define('views/role/record/table', 'view', function (Dep) {
|
||||
var $delete = this.$el.find('select[name="'+scope+'-delete"]');
|
||||
|
||||
if (!dontChange) {
|
||||
if (this.levelListMap.record.indexOf($delete.val()) < this.levelListMap.record.indexOf(value)) {
|
||||
if (this.levelList.indexOf($delete.val()) < this.levelList.indexOf(value)) {
|
||||
$delete.val(value);
|
||||
}
|
||||
}
|
||||
|
||||
$delete.find('option').each(function (i, o) {
|
||||
var $o = $(o);
|
||||
if (this.levelListMap.record.indexOf($o.val()) < this.levelListMap.record.indexOf(value)) {
|
||||
if (this.levelList.indexOf($o.val()) < this.levelList.indexOf(value)) {
|
||||
$o.attr('disabled', 'disabled');
|
||||
} else {
|
||||
$o.removeAttr('disabled');
|
||||
|
||||
Reference in New Issue
Block a user