CVE-2023-3293 (published 2023-06-16T11:15Z)

Cross-site Scripting (XSS) - Stored in GitHub repository salesagility/suitecrm-core prior to 8.3.0.

CVSS v3 base score: 4.8, MEDIUM (CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:C/C:L/I:L/A:N)

Weakness information:
cwe_id: CWE-79
cwe_name: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
description: The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
extended_description: 
            Cross-site scripting (XSS) vulnerabilities occur when:
            
               Untrusted data enters a web application, typically from a web request.
               The web application dynamically generates a web page that contains this untrusted data.
               During page generation, the application does not prevent the data from containing content that is executable by a web browser, such as JavaScript, HTML tags, HTML attributes, mouse events, Flash, ActiveX, etc.
               A victim visits the generated web page through a web browser, which contains malicious script that was injected using the untrusted data.
               Since the script comes from a web page that was sent by the web server, the victim's web browser executes the malicious script in the context of the web server's domain.
               This effectively violates the intention of the web browser's same-origin policy, which states that scripts in one domain should not be able to access resources or run code in a different domain.
            
            There are three main kinds of XSS:
            
               
                  Type 1: Reflected XSS (or Non-Persistent) - 
         			The server reads data directly from the HTTP request and reflects it back in the HTTP response. Reflected XSS exploits occur when an attacker causes a victim to supply dangerous content to a vulnerable web application, which is then reflected back to the victim and executed by the web browser. The most common mechanism for delivering malicious content is to include it as a parameter in a URL that is posted publicly or e-mailed directly to the victim. URLs constructed in this manner constitute the core of many phishing schemes, whereby an attacker convinces a victim to visit a URL that refers to a vulnerable site. After the site reflects the attacker's content back to the victim, the content is executed by the victim's browser.
               
                  Type 2: Stored XSS (or Persistent) - 
               The application stores dangerous data in a database, message forum, visitor log, or other trusted data store. At a later time, the dangerous data is subsequently read back into the application and included in dynamic content. From an attacker's perspective, the optimal place to inject malicious content is in an area that is displayed to either many users or particularly interesting users. Interesting users typically have elevated privileges in the application or interact with sensitive data that is valuable to the attacker. If one of these users executes malicious content, the attacker may be able to perform privileged operations on behalf of the user or gain access to sensitive data belonging to the user. For example, the attacker might inject XSS into a log message, which might not be handled properly when an administrator views the logs.
            
               
                  Type 0: DOM-Based XSS - 
               In DOM-based XSS, the client performs the injection of XSS into the page; in the other types, the server performs the injection. DOM-based XSS generally involves server-controlled, trusted script that is sent to the client, such as Javascript that performs sanity checks on a form before the user submits it. If the server-supplied script processes user-supplied data and then injects it back into the web page (such as with dynamic HTML), then DOM-based XSS is possible.
            
            
            Once the malicious script is injected, the attacker can perform a variety of malicious activities. The attacker could transfer private information, such as cookies that may include session information, from the victim's machine to the attacker. The attacker could send malicious requests to a web site on behalf of the victim, which could be especially dangerous to the site if the victim has administrator privileges to manage that site. Phishing attacks could be used to emulate trusted web sites and trick the victim into entering a password, allowing the attacker to compromise the victim's account on that web site. Finally, the script could exploit a vulnerability in the web browser itself possibly taking over the victim's machine, sometimes referred to as "drive-by hacking."
            In many cases, the attack can be launched without the victim even being aware of it. Even with careful users, attackers frequently use a variety of methods to encode the malicious portion of the attack, such as URL encoding or Unicode, so the request looks less suspicious.
         
         

Fix information:
repo_url: https://github.com/salesagility/suitecrm-core
commit_details: repo_url: https://github.com/salesagility/suitecrm-core
author: Jack Anderson
author_date: 2023-05-15 13:09:10+01:00
msg: SuiteCRM 8.3.0 Release
repository: repo_url: https://github.com/salesagility/suitecrm-core
repo_name: salesagility/SuiteCRM-Core
description: SuiteCRM - Open source CRM for the world
repo_language: PHP
owner: salesagility
file_changes: filename: .env
change_type: ModificationType.MODIFY
diff: @@ -61,3 +61,8 @@ LOCK_DSN=flock
 ###> login throttling ###
 LOGIN_THROTTLING_MAX_ATTEMPTS=5
 ###< login throttling ###
+
+###> login throttling ###
+LOGIN_THROTTLING_IP_LOGIN_MAX_ATTEMPTS=50
+LOGIN_THROTTLING_INTERVAL="30 minutes"
+###< login throttling ###

programming_language: Shell
filename: README.md
change_type: ModificationType.MODIFY
diff: @@ -2,7 +2,7 @@
   <img width="180px" height="41px" src="https://suitecrm.com/wp-content/uploads/2017/12/logo.png" align="right" />
 </a>
 
-# SuiteCRM 8.3-beta
+# SuiteCRM 8.3.0
 
 [![LICENSE](https://img.shields.io/github/license/suitecrm/suitecrm.svg)](https://github.com/salesagility/suitecrm/blob/hotfix/LICENSE.txt)
 [![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://github.com/salesagility/SuiteCRM-Core/issues)

programming_language: Markdown
filename: VERSION
change_type: ModificationType.MODIFY
diff: @@ -1 +1 @@
-8.3-beta
+8.3.0

programming_language: SQL
filename: core_services.yaml
change_type: ModificationType.MODIFY
diff: @@ -62,6 +62,7 @@ services:
       $samlAutoCreateAttributesMap: '%saml.autocreate.attributes_map%'
       $logoutConfig: '%auth.logout%'
       $sessionExpiredConfig: '%auth.session-expired%'
+      $adminOnlyModuleActions: '%system.admin_only_module_actions%'
       $navbarAdministrationOverrides: '%navbar.administration_override%'
   _instanceof:
     App\Process\Service\ProcessHandlerInterface:

programming_language: CoffeeScript
filename: security.php
change_type: ModificationType.MODIFY
diff: @@ -32,7 +32,9 @@ use App\Security\Ldap\AppLdapUserProvider;
 use App\Security\Saml\AppSamlAuthenticator;
 use App\Security\UserChecker;
 use Symfony\Component\DependencyInjection\Container;
+use Symfony\Component\DependencyInjection\Reference;
 use Symfony\Component\Ldap\Ldap;
+use Symfony\Component\Security\Http\RateLimiter\DefaultLoginRateLimiter;
 
 /** @var $container Container */
 if (!isset($container)) {
@@ -44,7 +46,36 @@ return static function (ContainerConfigurator $containerConfig) {
     $env = $_ENV ?? [];
     $authType = $env['AUTH_TYPE'] ?? 'native';
 
-    $maxAttempts = (int)($env['LOGIN_THROTTLING_MAX_ATTEMPTS'] ?? 3);
+    $maxAttempts = (int)($env['LOGIN_THROTTLING_MAX_ATTEMPTS'] ?? 5);
+    $ipLoginMaxAttempts = (int)($env['LOGIN_THROTTLING_IP_LOGIN_MAX_ATTEMPTS'] ?? 50);
+    $loginThrottlingInterval = (string)($env['LOGIN_THROTTLING_INTERVAL'] ?? '30 minutes');
+
+    $containerConfig->extension('framework', [
+        'rate_limiter' => [
+            // define 2 rate limiters (one for username+IP, the other for IP)
+            'username_ip_login' => [
+                'policy' => 'token_bucket',
+                'limit' => $maxAttempts,
+                'rate' => [ 'interval' => $loginThrottlingInterval ],
+            ],
+            'ip_login' => [
+                'policy' => 'sliding_window',
+                'limit' => $ipLoginMaxAttempts,
+                'interval' => $loginThrottlingInterval,
+            ],
+        ],
+    ]);
+
+    $containerConfig->services()->set('app.login_rate_limiter')
+        ->class(DefaultLoginRateLimiter::class)
+        ->args(
+            [
+                // 1st argument is the limiter for IP
+                new Reference('limiter.ip_login'),
+                // 2nd argument is the limiter for username+IP
+                new Reference('limiter.username_ip_login'),
+            ]
+        );
 
     $baseFirewall = [
         'dev' => [
@@ -84,7 +115,7 @@ return static function (ContainerConfigurator $containerConfig) {
                         'check_path' => 'app_login',
                     ],
                     'login_throttling' => [
-                        'max_attempts' => $maxAttempts
+                        'limiter' => 'app.login_rate_limiter'
                     ],
                     'logout' => [
                         'path' => 'app_logout'
@@ -170,7 +201,7 @@ return static function (ContainerConfigurator $containerConfig) {
                     'json_login_ldap' => $baseLdapConfig,
                     'provider' => $baseLdapConfig['provider'],
                     'login_throttling' => [
-                        'max_attempts' => $maxAttempts
+                        'limiter' => 'app.login_rate_limiter',
                     ],
                     'logout' => [
                         'path' => 'app_logout'
@@ -239,7 +270,7 @@ return static function (ContainerConfigurator $containerConfig) {
                         'check_path' => 'native_auth_login',
                     ],
                     'login_throttling' => [
-                        'max_attempts' => $maxAttempts,
+                        'limiter' => 'app.login_rate_limiter',
                     ],
                     'logout' => [
                         'path' => 'native_auth_logout'
@@ -255,7 +286,7 @@ return static function (ContainerConfigurator $containerConfig) {
                         'check_path' => 'native_auth_login',
                     ],
                     'login_throttling' => [
-                        'max_attempts' => $maxAttempts,
+                        'limiter' => 'app.login_rate_limiter',
                     ],
                     'logout' => [
                         'path' => 'native_auth_logout'

programming_language: PHP
filename: admin_only_module_actions.yaml
change_type: ModificationType.ADD
diff: @@ -0,0 +1,17 @@
+parameters:
+  system.admin_only_module_actions:
+    administration:
+      '*': true
+    users:
+      'list': true
+      'index': true
+    'sugar-feed':
+      'adminsettings': true
+    'address-cache':
+      '*': true
+    maps:
+      'geocoded_counts': true
+      'geocoding_test': true
+      'config': true
+    external-oauth-connection:
+      '*': true

programming_language: CoffeeScript
filename: package.json
change_type: ModificationType.MODIFY
diff: @@ -1,6 +1,6 @@
 {
   "name": "common",
-  "version": "8.3-beta",
+  "version": "8.3.0",
   "peerDependencies": {
     "@angular/common": "^12.1.0",
     "@angular/core": "^12.1.0",

programming_language: TypeScript
filename: package.json
change_type: ModificationType.MODIFY
diff: @@ -1,6 +1,6 @@
 {
   "name": "core",
-  "version": "8.3-beta",
+  "version": "8.3.0",
   "peerDependencies": {
     "@angular/common": "^12.1.0",
     "@angular/core": "^12.1.0",

programming_language: TypeScript
filename: record-list.store.ts
change_type: ModificationType.MODIFY
diff: @@ -777,7 +777,7 @@ export class RecordListStore implements StateStore, DataSource<Record>, Selectio
      * @param {string} pageSizeConfig to use
      */
     protected determinePageSize(pageSizePreference: any, pageSizeConfig: string): void {
-        let size = 0;
+        let size = 20;
 
         if (pageSizePreference) {
             size = pageSizePreference;

programming_language: TypeScript
filename: login.component.ts
change_type: ModificationType.MODIFY
diff: @@ -208,7 +208,7 @@ export class LoginUiComponent implements OnInit {
 
         const errorMessage = httpError?.error?.error ?? '';
 
-        if (errorMessage === 'Too many failed login attempts, please try again in 1 minute.') {
+        if (typeof errorMessage === 'string' && errorMessage.includes('Too many failed login attempts, please try again in')) {
             message = this.getTooManyFailedMessage(defaultTooManyFailedMessage);
         }
 

programming_language: TypeScript
filename: AclHandler.php
change_type: ModificationType.MODIFY
diff: @@ -100,6 +100,10 @@ class AclHandler extends LegacyHandler implements AclManagerInterface
 
         $hasAccess = ACLController::checkAccess($legacyName, $action, $isOwner, $type, $in_group);
 
+        if (check_default_module_access($legacyName) === false) {
+            $hasAccess = false;
+        }
+
         $this->close();
 
         return $hasAccess;

programming_language: PHP
filename: InstallActionHandler.php
change_type: ModificationType.MODIFY
diff: @@ -77,6 +77,14 @@ class InstallActionHandler implements ProcessHandlerInterface
         return '';
     }
 
+    /**
+     * @inheritDoc
+     */
+    public function getRequiredACLs(Process $process): array
+    {
+        return [];
+    }
+
     /**
      * @inheritDoc
      */

programming_language: PHP
filename: SetSessionLanguage.php
change_type: ModificationType.MODIFY
diff: @@ -100,6 +100,14 @@ class SetSessionLanguage extends LegacyHandler implements ProcessHandlerInterfac
         return 'ROLE_USER';
     }
 
+    /**
+     * @inheritDoc
+     */
+    public function getRequiredACLs(Process $process): array
+    {
+        return [];
+    }
+
     /**
      * @inheritDoc
      */

programming_language: PHP
filename: Version20230420135520.php
change_type: ModificationType.ADD
diff: @@ -0,0 +1,105 @@
+<?php
+/**
+ * SuiteCRM is a customer relationship management program developed by SalesAgility Ltd.
+ * Copyright (C) 2023 SalesAgility Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Affero General Public License version 3 as published by the
+ * Free Software Foundation with the addition of the following permission added
+ * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
+ * IN WHICH THE COPYRIGHT IS OWNED BY SALESAGILITY, SALESAGILITY DISCLAIMS THE
+ * WARRANTY OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
+ *
+ * This program 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 Affero General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * In accordance with Section 7(b) of the GNU Affero General Public License
+ * version 3, these Appropriate Legal Notices must retain the display of the
+ * "Supercharged by SuiteCRM" logo. If the display of the logos is not reasonably
+ * feasible for technical reasons, the Appropriate Legal Notices must display
+ * the words "Supercharged by SuiteCRM".
+ */
+
+declare(strict_types=1);
+
+namespace App\Migrations;
+
+use Doctrine\DBAL\Schema\Schema;
+use Psr\Log\LoggerInterface;
+use Symfony\Component\DependencyInjection\ContainerAwareInterface;
+use Symfony\Component\DependencyInjection\ContainerInterface;
+
+final class Version20230420135520 extends BaseMigration implements ContainerAwareInterface
+{
+    use EnvHandlingMigrationTrait;
+
+    /**
+     * @var ContainerInterface
+     */
+    protected $container;
+
+    /**
+     * @var LoggerInterface
+     */
+    protected $upgradeLogger;
+
+    public function getDescription(): string
+    {
+        return 'Add login throttling interval to .env';
+    }
+
+    public function isTransactional(): bool
+    {
+        return false;
+    }
+
+    public function up(Schema $schema): void
+    {
+        $envFile = $this->getProjectDir() . "/.env";
+
+        if (!file_exists($envFile)) {
+            return;
+        }
+
+        $envContents = file_get_contents($envFile);
+
+        $this->addLoginThrottlingConfig($envContents, $envFile);
+
+    }
+
+    public function down(Schema $schema): void
+    {
+    }
+
+    /**
+     * Check and add missing login throttling config
+     * @param $envContents
+     * @param string $envFile
+     */
+    protected function addLoginThrottlingConfig(&$envContents, string $envFile): void
+    {
+        $properties = [
+            'LOGIN_THROTTLING_IP_LOGIN_MAX_ATTEMPTS' => '50',
+            'LOGIN_THROTTLING_INTERVAL' => '"30 minutes"'
+        ];
+
+        $wrapperStart = '###> login throttling ###';
+        $wrapperEnd = '###< login throttling ###';
+
+        $propertiesToAdd = $this->getContentToAdd($envContents, $properties, $wrapperStart, $wrapperEnd);
+        if (!empty($propertiesToAdd)) {
+            $envContents .= $propertiesToAdd;
+            file_put_contents($envFile, $envContents);
+            $this->log('Added LOGIN_THROTTLING_INTERVAL to .env.');
+
+            return;
+        }
+
+        $this->log('LOGIN_THROTTLING_INTERVAL already in .env, skipping.');
+    }
+}

programming_language: PHP
filename: UpdateFavorite.php
change_type: ModificationType.MODIFY
diff: @@ -101,6 +101,26 @@ class UpdateFavorite extends LegacyHandler implements ProcessHandlerInterface
         return 'ROLE_USER';
     }
 
+    /**
+     * @inheritDoc
+     */
+    public function getRequiredACLs(Process $process): array
+    {
+        ['favorite' => $favorite] = $process->getOptions();
+
+        $module = $favorite['attributes']['parent_type'] ?? '';
+        $id = $favorite['attributes']['parent_id'] ?? '';
+
+        return [
+            $module => [
+                [
+                    'action' => 'view',
+                    'record' => $id
+                ]
+            ]
+        ];
+    }
+
     /**
      * @inheritDoc
      */
@@ -121,6 +141,15 @@ class UpdateFavorite extends LegacyHandler implements ProcessHandlerInterface
         if (empty($process->getOptions())) {
             throw new InvalidArgumentException(self::MSG_OPTIONS_NOT_FOUND);
         }
+
+        ['favorite' => $favorite, 'action' => $action] = $process->getOptions();
+
+        $module = $favorite['attributes']['parent_type'] ?? '';
+        $id = $favorite['attributes']['parent_id'] ?? '';
+
+        if (empty($module) || empty($id) || empty($action)) {
+            throw new InvalidArgumentException(self::MSG_OPTIONS_NOT_FOUND);
+        }
     }
 
     /**

programming_language: PHP
filename: AddRecentlyViewed.php
change_type: ModificationType.MODIFY
diff: @@ -107,6 +107,25 @@ class AddRecentlyViewed extends LegacyHandler implements ProcessHandlerInterface
         return 'ROLE_USER';
     }
 
+    /**
+     * @inheritDoc
+     */
+    public function getRequiredACLs(Process $process): array
+    {
+        ['recentlyViewed' => $recentlyViewed] = $process->getOptions();
+        $itemId = $recentlyViewed['attributes']['item_id'] ?? '';
+        $itemModule = $recentlyViewed['attributes']['module_name'] ?? '';
+
+        return [
+            $itemModule => [
+                [
+                    'action' => 'view',
+                    'record' => $itemId,
+                ]
+            ]
+        ];
+    }
+
     /**
      * @inheritDoc
      */
@@ -127,6 +146,16 @@ class AddRecentlyViewed extends LegacyHandler implements ProcessHandlerInterface
         if (empty($process->getOptions())) {
             throw new InvalidArgumentException(self::MSG_OPTIONS_NOT_FOUND);
         }
+
+        ['recentlyViewed' => $recentlyViewed] = $process->getOptions();
+        $itemModule = $recentlyViewed['attributes']['module_name'] ?? '';
+        $itemModule = $this->moduleNameMapper->toLegacy($itemModule);
+        $action = $recentlyViewed['attributes']['action'] ?? '';
+
+
+        if (empty($itemModule) || empty($action)) {
+            throw new InvalidArgumentException(self::MSG_OPTIONS_NOT_FOUND);
+        }
     }
 
     /**

programming_language: PHP
filename: RecentlyViewedHandler.php
change_type: ModificationType.MODIFY
diff: @@ -1,4 +1,29 @@
 <?php
+/**
+ * SuiteCRM is a customer relationship management program developed by SalesAgility Ltd.
+ * Copyright (C) 2021 SalesAgility Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Affero General Public License version 3 as published by the
+ * Free Software Foundation with the addition of the following permission added
+ * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
+ * IN WHICH THE COPYRIGHT IS OWNED BY SALESAGILITY, SALESAGILITY DISCLAIMS THE
+ * WARRANTY OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
+ *
+ * This program 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 Affero General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * In accordance with Section 7(b) of the GNU Affero General Public License
+ * version 3, these Appropriate Legal Notices must retain the display of the
+ * "Supercharged by SuiteCRM" logo. If the display of the logos is not reasonably
+ * feasible for technical reasons, the Appropriate Legal Notices must display
+ * the words "Supercharged by SuiteCRM".
+ */
 
 namespace App\Module\LegacyHandler\RecentlyViewed;
 

programming_language: PHP
filename: ProcessDataPersister.php
change_type: ModificationType.MODIFY
diff: @@ -30,9 +30,10 @@ namespace App\Process\DataPersister;
 
 use ApiPlatform\Core\DataPersister\ContextAwareDataPersisterInterface;
 use ApiPlatform\Core\Exception\InvalidResourceException;
+use App\Engine\Service\AclManagerInterface;
 use App\Process\Entity\Process;
-use App\Process\Service\ProcessHandlerRegistry;
 use App\Process\Service\ProcessHandlerInterface;
+use App\Process\Service\ProcessHandlerRegistry;
 use Symfony\Component\Security\Core\Exception\AccessDeniedException;
 use Symfony\Component\Security\Core\Security;
 
@@ -42,20 +43,28 @@ class ProcessDataPersister implements ContextAwareDataPersisterInterface
      * @var ProcessHandlerRegistry
      */
     private $registry;
+
     /**
      * @var Security
      */
     private $security;
 
+    /**
+     * @var AclManagerInterface
+     */
+    private $acl;
+
     /**
      * ProcessDataPersister constructor.
      * @param ProcessHandlerRegistry $registry
      * @param Security $security
+     * @param AclManagerInterface $acl
      */
-    public function __construct(ProcessHandlerRegistry $registry, Security $security)
+    public function __construct(ProcessHandlerRegistry $registry, Security $security, AclManagerInterface $acl)
     {
         $this->registry = $registry;
         $this->security = $security;
+        $this->acl = $acl;
     }
 
     /**
@@ -79,8 +88,18 @@ class ProcessDataPersister implements ContextAwareDataPersisterInterface
         $this->checkAuthentication($processHandler);
 
         $processHandler->validate($process);
+
+        $hasAccess = $this->checkACLAccess($processHandler, $process);
+
         $processHandler->configure($process);
 
+        if (!$hasAccess) {
+            $process->setMessages(['LBL_ACCESS_DENIED']);
+            $process->setStatus('error');
+
+            return $process;
+        }
+
         if ($process->getAsync() === true) {
             // Store process for background processing
             // Not supported yet
@@ -108,6 +127,63 @@ class ProcessDataPersister implements ContextAwareDataPersisterInterface
         throw new AccessDeniedException();
     }
 
+    /**
+     * Check acl access
+     * @param ProcessHandlerInterface $processHandler
+     * @param Process $process
+     */
+    protected function checkACLAccess(ProcessHandlerInterface $processHandler, Process $process): bool
+    {
+        $modulesACLs = $processHandler->getRequiredACLs($process) ?? [];
+        if (empty($modulesACLs)) {
+            return true;
+        }
+
+        $hasAccess = true;
+        foreach ($modulesACLs as $module => $requiredACLs) {
+            if (empty($requiredACLs)) {
+                continue;
+            }
+            if (empty($module)) {
+                continue;
+            }
+
+            if ($hasAccess === false) {
+                return false;
+            }
+
+            foreach ($requiredACLs as $requiredACL) {
+                $record = $requiredACL['record'] ?? '';
+                $ids = $requiredACL['ids'] ?? '';
+                $action = $requiredACL['action'] ?? '';
+
+                if (empty($action)) {
+                    continue;
+                }
+
+                if ($hasAccess === false) {
+                    return false;
+                }
+
+                if (empty($record) && empty($ids)) {
+                    $hasAccess &= $this->acl->checkAccess($module, $action, true, 'module', true);
+                    continue;
+                }
+
+                if (!empty($record)) {
+                    $hasAccess &= $this->acl->checkRecordAccess($module, $action, $record);
+                    continue;
+                }
+
+                if (!empty($ids)) {
+                    $hasAccess &= $this->checkRecordsAccess($ids, $module, $action);
+                }
+            }
+        }
+
+        return $hasAccess;
+    }
+
     /**
      * Handler process deletion request
      * @param $data
@@ -119,4 +195,26 @@ class ProcessDataPersister implements ContextAwareDataPersisterInterface
         // Deleting processes is not supported
         throw new InvalidResourceException();
     }
+
+    /**
+     * @param array $ids
+     * @param string $module
+     * @param string $action
+     * @return bool
+     */
+    protected function checkRecordsAccess(array $ids, string $module, string $action): bool
+    {
+        if (empty($ids)) {
+            return true;
+        }
+
+        foreach ($ids as $id) {
+            $hasAccess = $this->acl->checkRecordAccess($module, $action, $id);
+            if ($hasAccess === false) {
+                return false;
+            }
+        }
+
+        return true;
+    }
 }

programming_language: PHP
filename: UserACLHandler.php
change_type: ModificationType.MODIFY
diff: @@ -30,9 +30,9 @@ namespace App\Process\LegacyHandler\ACL;
 use ApiPlatform\Core\Exception\InvalidArgumentException;
 use App\Engine\LegacyHandler\LegacyHandler;
 use App\Engine\LegacyHandler\LegacyScopeState;
-use App\Engine\Service\AclManagerInterface;
 use App\Module\Service\ModuleNameMapperInterface;
 use App\Process\Entity\Process;
+use App\Process\Service\ActionNameMapperInterface;
 use App\Process\Service\BaseActionDefinitionProviderInterface;
 use App\Process\Service\LegacyActionResolverInterface;
 use App\Process\Service\ProcessHandlerInterface;
@@ -65,10 +65,16 @@ class UserACLHandler extends LegacyHandler implements ProcessHandlerInterface, L
      * @var LegacyActionResolverInterface
      */
     private $legacyActionResolver;
+
+    /**
+     * @var array
+     */
+    private $adminOnlyModuleActions;
+
     /**
-     * @var AclManagerInterface
+     * @var ActionNameMapperInterface
      */
-    private $acl;
+    private $actionNameMapper;
 
     /**
      * UserACLHandler constructor.
@@ -81,7 +87,7 @@ class UserACLHandler extends LegacyHandler implements ProcessHandlerInterface, L
      * @param ModuleNameMapperInterface $moduleNameMapper
      * @param BaseActionDefinitionProviderInterface $baseActionDefinitionProvider
      * @param LegacyActionResolverInterface $legacyActionResolver
-     * @param AclManagerInterface $acl
+     * @param array $adminOnlyModuleActions
      */
     public function __construct(
         string $projectDir,
@@ -93,7 +99,8 @@ class UserACLHandler extends LegacyHandler implements ProcessHandlerInterface, L
         ModuleNameMapperInterface $moduleNameMapper,
         BaseActionDefinitionProviderInterface $baseActionDefinitionProvider,
         LegacyActionResolverInterface $legacyActionResolver,
-        AclManagerInterface $acl
+        ActionNameMapperInterface $actionNameMapper,
+        array $adminOnlyModuleActions
     ) {
         parent::__construct(
             $projectDir,
@@ -106,7 +113,8 @@ class UserACLHandler extends LegacyHandler implements ProcessHandlerInterface, L
         $this->moduleNameMapper = $moduleNameMapper;
         $this->baseActionDefinitionProvider = $baseActionDefinitionProvider;
         $this->legacyActionResolver = $legacyActionResolver;
-        $this->acl = $acl;
+        $this->actionNameMapper = $actionNameMapper;
+        $this->adminOnlyModuleActions = $adminOnlyModuleActions;
     }
 
     /**
@@ -133,6 +141,14 @@ class UserACLHandler extends LegacyHandler implements ProcessHandlerInterface, L
         return 'ROLE_USER';
     }
 
+    /**
+     * @inheritDoc
+     */
+    public function getRequiredACLs(Process $process): array
+    {
+        return [];
+    }
+
     /**
      * @inheritDoc
      */
@@ -209,6 +225,14 @@ class UserACLHandler extends LegacyHandler implements ProcessHandlerInterface, L
             $hasAccess = true;
         }
 
+        global $current_user;
+        $isAdmin = is_admin($current_user);
+        $isActionAdminOnly = $this->isAdminOnlyAction($frontEndModuleName, $legacyModuleName, $actionKey, $queryParams);
+
+        if ($isActionAdminOnly && !$isAdmin) {
+            $hasAccess = false;
+        }
+
         $service = new UserACLService();
         $result = $service->run($legacyModuleName, $payload['routeURL'], $hasAccess);
 
@@ -245,6 +269,7 @@ class UserACLHandler extends LegacyHandler implements ProcessHandlerInterface, L
         if (empty($actionModuleIdentifierKey)) {
             return '';
         }
+
         return $actionModuleIdentifierKey;
     }
 
@@ -255,8 +280,11 @@ class UserACLHandler extends LegacyHandler implements ProcessHandlerInterface, L
      * @param array $queryParams
      * @return string
      */
-    protected function getResolvedLegacyModule(string $primaryAction, string $secondaryAction, array $queryParams): string
-    {
+    protected function getResolvedLegacyModule(
+        string $primaryAction,
+        string $secondaryAction,
+        array $queryParams
+    ): string {
         $actionModuleIdentifierKey = $this->entryExistsInLegacyActionMapper($primaryAction, $secondaryAction);
 
         if (empty($actionModuleIdentifierKey)) {
@@ -273,4 +301,37 @@ class UserACLHandler extends LegacyHandler implements ProcessHandlerInterface, L
     {
         $this->logger = $logger;
     }
+
+    /**
+     * @param string $module
+     * @param string $legacyModule
+     * @param string $actionKey
+     * @param array $queryParams
+     * @return bool
+     */
+    protected function isAdminOnlyAction(string $module, string $legacyModule,  string $actionKey, array $queryParams): bool
+    {
+        if (!empty($queryParams['import_module']) && strtolower($module) === 'import') {
+            $module = $this->moduleNameMapper->toFrontEnd($queryParams['import_module']);
+            $legacyModule = $queryParams['import_module'];
+            $actionKey = 'import';
+        }
+
+        $adminOnlyList = [];
+
+        /* @noinspection PhpIncludeInspection */
+        require_once 'include/modules.php';
+        $legacyActionName = strtolower($this->actionNameMapper->toLegacy($actionKey));
+        $adminOnlyActions = $adminOnlyList[$legacyModule] ?? [];
+        $adminOnlyAction = $adminOnlyActions[$legacyActionName] ?? $adminOnlyActions['all'] ?? false;
+        $isActionAdminOnly = !empty($adminOnlyAction) && $adminOnlyAction !== 'allow';
+
+        if ($isActionAdminOnly) {
+            return true;
+        }
+
+        $adminOnlyActions = $this->adminOnlyModuleActions[$module] ?? [];
+
+        return $adminOnlyActions[strtolower($actionKey)] ?? $adminOnlyActions['*'] ?? false;
+    }
 }

programming_language: PHP
filename: AddContactsToTargetListBulkActionHandler.php
change_type: ModificationType.MODIFY
diff: @@ -108,6 +108,34 @@ class AddContactsToTargetListBulkActionHandler extends LegacyHandler implements
         return 'ROLE_USER';
     }
 
+    /**
+     * @inheritDoc
+     */
+    public function getRequiredACLs(Process $process): array
+    {
+        $options = $process->getOptions();
+        $baseModule = $options['module'] ?? '';
+        $baseIds = $options['ids'] ?? [];
+        $modalRecord = $options['modalRecord'] ?? [];
+        $modalModule = $modalRecord['module'] ?? '';
+        $modalRecordId = $modalRecord['id'] ?? '';
+
+        return [
+            $baseModule => [
+                [
+                    'action' => 'view',
+                    'ids' => $baseIds
+                ]
+            ],
+            $modalModule => [
+                [
+                    'action' => 'view',
+                    'record' => $modalRecordId,
+                ]
+            ],
+        ];
+    }
+
     /**
      * @inheritDoc
      */
@@ -152,6 +180,7 @@ class AddContactsToTargetListBulkActionHandler extends LegacyHandler implements
     public function run(Process $process)
     {
         $this->init();
+        $this->startLegacyApp();
 
         /* @noinspection PhpIncludeInspection */
         require_once 'include/portability/Services/Relationships/AddContactsToTargetListService.php';

programming_language: PHP
filename: AddRecordsToTargetListBulkActionHandler.php
change_type: ModificationType.MODIFY
diff: @@ -108,6 +108,30 @@ class AddRecordsToTargetListBulkActionHandler extends LegacyHandler implements P
         return 'ROLE_USER';
     }
 
+    /**
+     * @inheritDoc
+     */
+    public function getRequiredACLs(Process $process): array
+    {
+        $options = $process->getOptions();
+        $baseModule = $options['module'] ?? '';
+        $baseIds = $options['ids'] ?? [];
+        $modalRecord = $options['modalRecord'] ?? [];
+        $modalModule = $modalRecord['module'] ?? '';
+
+        return [
+            $baseModule => [
+                [
+                    'action' => 'view',
+                    'ids' => $baseIds
+                ]
+            ],
+            $modalModule => [
+                ['action' => 'view']
+            ],
+        ];
+    }
+
     /**
      * @inheritDoc
      */

programming_language: PHP
filename: LinkRelationHandler.php
change_type: ModificationType.MODIFY
diff: @@ -114,6 +114,34 @@ class LinkRelationHandler extends LegacyHandler implements ProcessHandlerInterfa
         return 'ROLE_USER';
     }
 
+    /**
+     * @inheritDoc
+     */
+    public function getRequiredACLs(Process $process): array
+    {
+        $options = $process->getOptions();
+        $baseModule = $options['module'] ?? '';
+        $baseModuleId = $options['id'] ?? '';
+        $payload = $options['payload'] ?? [];
+        $relateModule = $payload['relateModule'] ?? '';
+        $relateRecordIds = $payload['relateRecordIds'] ?? [];
+
+        return [
+            $baseModule => [
+                [
+                    'action' => 'view',
+                    'record' => $baseModuleId
+                ]
+            ],
+            $relateModule => [
+                [
+                    'action' => 'view',
+                    'ids' => $relateRecordIds
+                ]
+            ]
+        ];
+    }
+
     /**
      * @inheritDoc
      */

programming_language: PHP
filename: ResetPasswordHandler.php
change_type: ModificationType.MODIFY
diff: @@ -30,8 +30,8 @@ namespace App\Process\LegacyHandler;
 
 
 use ApiPlatform\Core\Exception\InvalidArgumentException;
-use App\Process\Entity\Process;
 use App\Engine\LegacyHandler\LegacyHandler;
+use App\Process\Entity\Process;
 use App\Process\Service\ProcessHandlerInterface;
 use BadFunctionCallException;
 use Exception;
@@ -73,6 +73,15 @@ class ResetPasswordHandler extends LegacyHandler implements ProcessHandlerInterf
         return '';
     }
 
+    /**
+     * @inheritDoc
+     */
+    public function getRequiredACLs(Process $process): array
+    {
+        return [];
+    }
+
+
     /**
      * @inheritDoc
      */
@@ -122,7 +131,7 @@ class ResetPasswordHandler extends LegacyHandler implements ProcessHandlerInterf
 
         try {
             $service->sendResetLink($username, $useremail);
-        } catch (BadFunctionCallException | \InvalidArgumentException $e) {
+        } catch (BadFunctionCallException|\InvalidArgumentException $e) {
             //logged by suite 7
         } catch (Exception $unknownException) {
             $this->logger->error($unknownException->getMessage(), ['exception' => $unknownException]);

programming_language: PHP
filename: UnlinkRelationHandler.php
change_type: ModificationType.MODIFY
diff: @@ -106,6 +106,48 @@ class UnlinkRelationHandler extends LegacyHandler implements ProcessHandlerInter
         return 'ROLE_USER';
     }
 
+    /**
+     * @inheritDoc
+     */
+    public function getRequiredACLs(Process $process): array
+    {
+        $options = $process->getOptions();
+        $payload = $options['payload'] ?? [];
+        $baseModule = $payload['baseModule'] ?? '';
+        $relateModule = $payload['relateModule'] ?? '';
+        $relateModuleId = $payload['relateRecordId'] ?? '';
+
+        $acls = [
+            $baseModule => [
+                [
+                    'action' => 'view',
+                    'record' => $payload['baseRecordId'] ?? ''
+                ],
+                [
+                    'action' => 'edit'
+                ],
+            ],
+            $relateModule => [
+                [
+                    'action' => 'view',
+                    'record' => $relateModuleId
+                ]
+            ]
+        ];
+
+        if (!empty($relateModule) && !empty($relateModuleId)) {
+            $acls[$relateModule] = [
+                [
+                    'action' => 'view',
+                    'record' =>  $relateModuleId ?? ''
+                ]
+            ];
+        }
+
+        return $acls;
+    }
+
+
     /**
      * @inheritDoc
      */

programming_language: PHP
filename: CsvExportBulkAction.php
change_type: ModificationType.MODIFY
diff: @@ -29,9 +29,9 @@
 namespace App\Process\Service\BulkActions;
 
 use ApiPlatform\Core\Exception\InvalidArgumentException;
-use App\Process\Entity\Process;
 use App\Data\LegacyHandler\FilterMapper\LegacyFilterMapper;
 use App\Module\Service\ModuleNameMapperInterface;
+use App\Process\Entity\Process;
 use App\Process\Service\ProcessHandlerInterface;
 
 class CsvExportBulkAction implements ProcessHandlerInterface
@@ -76,6 +76,25 @@ class CsvExportBulkAction implements ProcessHandlerInterface
         return 'ROLE_USER';
     }
 
+    /**
+     * @inheritDoc
+     */
+    public function getRequiredACLs(Process $process): array
+    {
+        $options = $process->getOptions();
+        $module = $options['module'] ?? '';
+        $ids = $options['ids'] ?? [];
+
+        return [
+            $module => [
+                [
+                    'action' => 'export',
+                    'ids' => $ids
+                ]
+            ]
+        ];
+    }
+
     /**
      * @inheritDoc
      */

programming_language: PHP
filename: DeleteRecordsBulkAction.php
change_type: ModificationType.MODIFY
diff: @@ -86,6 +86,25 @@ class DeleteRecordsBulkAction implements ProcessHandlerInterface, LoggerAwareInt
         return 'ROLE_USER';
     }
 
+    /**
+     * @inheritDoc
+     */
+    public function getRequiredACLs(Process $process): array
+    {
+        $options = $process->getOptions();
+        $module = $options['module'] ?? '';
+        $ids = $options['ids'] ?? [];
+
+        return [
+            $module => [
+                [
+                    'action' => 'delete',
+                    'ids' => $ids
+                ]
+            ]
+        ];
+    }
+
     /**
      * @inheritDoc
      */

programming_language: PHP
filename: MassUpdateBulkAction.php
change_type: ModificationType.MODIFY
diff: @@ -86,6 +86,29 @@ class MassUpdateBulkAction implements ProcessHandlerInterface, LoggerAwareInterf
         return 'ROLE_USER';
     }
 
+    /**
+     * @inheritDoc
+     */
+    public function getRequiredACLs(Process $process): array
+    {
+        $options = $process->getOptions();
+        $module = $options['module'] ?? '';
+        $ids = $options['ids'] ?? [];
+
+        return [
+            $module => [
+                [
+                    'action' => 'edit',
+                    'ids' => $ids
+                ],
+                [
+                    'action' => 'massupdate'
+                ]
+            ],
+        ];
+    }
+
+
     /**
      * @inheritDoc
      */

programming_language: PHP
filename: MergeRecordsBulkAction.php
change_type: ModificationType.MODIFY
diff: @@ -29,8 +29,8 @@
 namespace App\Process\Service\BulkActions;
 
 use ApiPlatform\Core\Exception\InvalidArgumentException;
-use App\Process\Entity\Process;
 use App\Module\Service\ModuleNameMapperInterface;
+use App\Process\Entity\Process;
 use App\Process\Service\ProcessHandlerInterface;
 use Psr\Log\LoggerAwareInterface;
 use Psr\Log\LoggerInterface;
@@ -75,6 +75,28 @@ class MergeRecordsBulkAction implements ProcessHandlerInterface, LoggerAwareInte
         return 'ROLE_USER';
     }
 
+    /**
+     * @inheritDoc
+     */
+    public function getRequiredACLs(Process $process): array
+    {
+        $options = $process->getOptions();
+        $module = $options['module'] ?? '';
+        $ids = $options['ids'] ?? [];
+
+        return [
+            $module => [
+                [
+                    'action' => 'view'
+                ],
+                [
+                    'action' => 'edit',
+                    'ids' => $ids
+                ]
+            ]
+        ];
+    }
+
     /**
      * @inheritDoc
      */

programming_language: PHP
filename: PrintAsPdfBulkAction.php
change_type: ModificationType.MODIFY
diff: @@ -29,8 +29,8 @@
 namespace App\Process\Service\BulkActions;
 
 use ApiPlatform\Core\Exception\InvalidArgumentException;
-use App\Process\Entity\Process;
 use App\Module\Service\ModuleNameMapperInterface;
+use App\Process\Entity\Process;
 use App\Process\Service\ProcessHandlerInterface;
 
 class PrintAsPdfBulkAction implements ProcessHandlerInterface
@@ -68,6 +68,29 @@ class PrintAsPdfBulkAction implements ProcessHandlerInterface
         return 'ROLE_USER';
     }
 
+    /**
+     * @inheritDoc
+     */
+    public function getRequiredACLs(Process $process): array
+    {
+        $options = $process->getOptions();
+        $module = $options['module'] ?? '';
+        $ids = $options['ids'] ?? [];
+
+
+        return [
+            $module => [
+                [
+                    'action' => 'view'
+                ],
+                [
+                    'action' => 'export',
+                    'ids' => $ids
+                ]
+            ]
+        ];
+    }
+
     /**
      * @inheritDoc
      */

programming_language: PHP
filename: ProcessHandlerInterface.php
change_type: ModificationType.MODIFY
diff: @@ -45,6 +45,14 @@ interface ProcessHandlerInterface
      */
     public function requiredAuthRole(): string;
 
+    /**
+     * Get required acls list per module, empty array means no acl check needed
+     *
+     * @param Process $process
+     * @return array
+     */
+    public function getRequiredACLs(Process $process): array;
+
     /**
      * Configure process for given type
      * @param Process $process

programming_language: PHP
filename: ChangeLogAction.php
change_type: ModificationType.MODIFY
diff: @@ -67,6 +67,25 @@ class ChangeLogAction implements ProcessHandlerInterface
         return 'ROLE_USER';
     }
 
+    /**
+     * @inheritDoc
+     */
+    public function getRequiredACLs(Process $process): array
+    {
+        $options = $process->getOptions();
+        $module = $options['module'] ?? '';
+        $recordId = $options['id'] ?? '';
+
+        return [
+            $module => [
+                [
+                    'action' => 'view',
+                    'record' => $recordId
+                ]
+            ],
+        ];
+    }
+
     /**
      * @inheritDoc
      */

programming_language: PHP
filename: ConvertLeadAction.php
change_type: ModificationType.MODIFY
diff: @@ -28,8 +28,8 @@
 namespace App\Process\Service\RecordActions;
 
 use ApiPlatform\Core\Exception\InvalidArgumentException;
-use App\Process\Entity\Process;
 use App\Module\Service\ModuleNameMapperInterface;
+use App\Process\Entity\Process;
 use App\Process\Service\ProcessHandlerInterface;
 
 class ConvertLeadAction implements ProcessHandlerInterface
@@ -67,6 +67,26 @@ class ConvertLeadAction implements ProcessHandlerInterface
         return 'ROLE_USER';
     }
 
+    /**
+     * @inheritDoc
+     */
+    public function getRequiredACLs(Process $process): array
+    {
+        $options = $process->getOptions();
+        $module = $options['module'] ?? '';
+        $id = $options['id'] ?? '';
+
+        return [
+            $module => [
+                [
+                    'action' => 'view',
+                    'record' => $id
+                ],
+            ],
+        ];
+
+    }
+
     /**
      * @inheritDoc
      */

programming_language: PHP
filename: DeleteRecordAction.php
change_type: ModificationType.MODIFY
diff: @@ -79,6 +79,24 @@ class DeleteRecordAction implements ProcessHandlerInterface
         return 'ROLE_USER';
     }
 
+    /**
+     * @inheritDoc
+     */
+    public function getRequiredACLs(Process $process): array
+    {
+        $options = $process->getOptions();
+        $module = $options['module'] ?? '';
+
+        return [
+            $module => [
+                [
+                    'action' => 'delete',
+                    'record' => $options['id'] ?? ''
+                ]
+            ],
+        ];
+    }
+
     /**
      * @inheritDoc
      */

programming_language: PHP
filename: DuplicateRecordAction.php
change_type: ModificationType.MODIFY
diff: @@ -68,6 +68,24 @@ class DuplicateRecordAction implements ProcessHandlerInterface
         return 'ROLE_USER';
     }
 
+    /**
+     * @inheritDoc
+     */
+    public function getRequiredACLs(Process $process): array
+    {
+        $options = $process->getOptions();
+        $module = $options['module'] ?? '';
+
+        return [
+            $module => [
+                [
+                    'action' => 'edit',
+                    'record' => $options['id'] ?? ''
+                ]
+            ],
+        ];
+    }
+
     /**
      * @inheritDoc
      */

programming_language: PHP
filename: EditAction.php
change_type: ModificationType.MODIFY
diff: @@ -67,6 +67,33 @@ class EditAction implements ProcessHandlerInterface
         return 'ROLE_USER';
     }
 
+    /**
+     * @inheritDoc
+     */
+    public function getRequiredACLs(Process $process): array
+    {
+        $options = $process->getOptions();
+        $module = $options['module'] ?? '';
+
+        $baseModule = $options['payload']['baseModule'] ?? '';
+        $baseRecord = $options['payload']['baseRecordId'] ?? '';
+
+        return [
+            $module => [
+                [
+                    'action' => 'edit',
+                    'record' => $options['id'] ?? ''
+                ]
+            ],
+            $baseModule => [
+                [
+                    'action' => 'view',
+                    'record' => $baseRecord
+                ]
+            ],
+        ];
+    }
+
     /**
      * @inheritDoc
      */

programming_language: PHP
filename: MergeDuplicateAction.php
change_type: ModificationType.MODIFY
diff: @@ -67,6 +67,24 @@ class MergeDuplicateAction implements ProcessHandlerInterface
         return 'ROLE_USER';
     }
 
+    /**
+     * @inheritDoc
+     */
+    public function getRequiredACLs(Process $process): array
+    {
+        $options = $process->getOptions();
+        $module = $options['module'] ?? '';
+
+        return [
+            $module => [
+                [
+                    'action' => 'edit',
+                    'record' => $options['id'] ?? ''
+                ]
+            ],
+        ];
+    }
+
     /**
      * @inheritDoc
      */

programming_language: PHP
filename: PrintAsPdfAction.php
change_type: ModificationType.MODIFY
diff: @@ -68,6 +68,46 @@ class PrintAsPdfAction implements ProcessHandlerInterface
         return 'ROLE_USER';
     }
 
+    /**
+     * @inheritDoc
+     */
+    public function getRequiredACLs(Process $process): array
+    {
+        $options = $process->getOptions();
+        $module = $options['module'] ?? '';
+
+        $modalRecord = $options['params']['modalRecord'] ?? [];
+        $modalRecordModule = $modalRecord['module'] ?? '';
+        $modalRecordId = $modalRecord['id'] ?? '';
+
+        $acls = [
+            $module => [
+                [
+                    'action' => 'view',
+                    'record' => $options['id'] ?? ''
+                ],
+                [
+                    'action' => 'export',
+                    'record' => $options['id'] ?? ''
+                ]
+            ],
+        ];
+
+        if ($modalRecordModule !== '') {
+            $acls[$modalRecordModule] = [
+                [
+                    [
+                        'action' => 'view',
+                        'record' => $modalRecordId
+                    ]
+                ]
+            ];
+        }
+
+        return $acls;
+
+    }
+
     /**
      * @inheritDoc
      */

programming_language: PHP
filename: DeleteRecordThreadItemAction.php
change_type: ModificationType.MODIFY
diff: @@ -78,6 +78,24 @@ class DeleteRecordThreadItemAction implements ProcessHandlerInterface
         return 'ROLE_USER';
     }
 
+    /**
+     * @inheritDoc
+     */
+    public function getRequiredACLs(Process $process): array
+    {
+        $options = $process->getOptions();
+        $module = $options['module'] ?? '';
+
+        return [
+            $module => [
+                [
+                    'action' => 'delete',
+                    'record' => $options['id'] ?? ''
+                ]
+            ],
+        ];
+    }
+
     /**
      * {@inheritDoc}
      */

programming_language: PHP
filename: DismissAlertAction.php
change_type: ModificationType.MODIFY
diff: @@ -70,6 +70,24 @@ class DismissAlertAction implements ProcessHandlerInterface
         return 'ROLE_USER';
     }
 
+    /**
+     * @inheritDoc
+     */
+    public function getRequiredACLs(Process $process): array
+    {
+        $options = $process->getOptions();
+        $module = $options['module'] ?? '';
+
+        return [
+            $module => [
+                [
+                    'action' => 'delete',
+                    'record' => $options['id'] ?? ''
+                ]
+            ],
+        ];
+    }
+
     /**
      * @inheritDoc
      */

programming_language: PHP
filename: SnoozeRecordThreadItemAction.php
change_type: ModificationType.MODIFY
diff: @@ -78,6 +78,24 @@ class SnoozeRecordThreadItemAction implements ProcessHandlerInterface
         return 'ROLE_USER';
     }
 
+    /**
+     * @inheritDoc
+     */
+    public function getRequiredACLs(Process $process): array
+    {
+        $options = $process->getOptions();
+        $module = $options['module'] ?? '';
+
+        return [
+            $module => [
+                [
+                    'action' => 'view',
+                    'record' => $options['id'] ?? ''
+                ]
+            ],
+        ];
+    }
+
     /**
      * {@inheritDoc}
      */

programming_language: PHP
filename: DeleteAllRecordThreadListAction.php
change_type: ModificationType.MODIFY
diff: @@ -74,6 +74,25 @@ class DeleteAllRecordThreadListAction implements ProcessHandlerInterface
         return 'ROLE_USER';
     }
 
+    /**
+     * @inheritDoc
+     */
+    public function getRequiredACLs(Process $process): array
+    {
+        $options = $process->getOptions();
+        $module = $options['module'] ?? '';
+        $ids = $options['ids'] ?? [];
+
+        return [
+            $module => [
+                [
+                    'action' => 'delete',
+                    'ids' => $ids
+                ]
+            ],
+        ];
+    }
+
     /**
      * {@inheritDoc}
      */

programming_language: PHP
filename: DismissAllAlertsRecordThreadListAction.php
change_type: ModificationType.MODIFY
diff: @@ -69,6 +69,24 @@ class DismissAllAlertsRecordThreadListAction implements ProcessHandlerInterface
         return 'ROLE_USER';
     }
 
+    /**
+     * @inheritDoc
+     */
+    public function getRequiredACLs(Process $process): array
+    {
+        $options = $process->getOptions();
+        $ids = $options['ids'] ?? [];
+
+        return [
+            'alerts' => [
+                [
+                    'action' => 'delete',
+                    'ids' => $ids
+                ]
+            ],
+        ];
+    }
+
     /**
      * {@inheritDoc}
      */

programming_language: PHP
filename: MarkAsReadRecordThreadListAction.php
change_type: ModificationType.MODIFY
diff: @@ -112,6 +112,25 @@ class MarkAsReadRecordThreadListAction extends LegacyHandler implements ProcessH
         return 'ROLE_USER';
     }
 
+    /**
+     * @inheritDoc
+     */
+    public function getRequiredACLs(Process $process): array
+    {
+        $options = $process->getOptions();
+        $module = $options['module'] ?? '';
+        $ids = $options['ids'] ?? [];
+
+        return [
+            $module => [
+                [
+                    'action' => 'view',
+                    'ids' => $ids
+                ]
+            ],
+        ];
+    }
+
     /**
      * {@inheritDoc}
      */

programming_language: PHP
filename: SaveUiPreferences.php
change_type: ModificationType.MODIFY
diff: @@ -69,6 +69,14 @@ class SaveUiPreferences extends LegacyHandler implements ProcessHandlerInterface
         return 'ROLE_USER';
     }
 
+    /**
+     * @inheritDoc
+     */
+    public function getRequiredACLs(Process $process): array
+    {
+        return [];
+    }
+
     /**
      * @inheritDoc
      */

programming_language: PHP
filename: package.json
change_type: ModificationType.MODIFY
diff: @@ -1,6 +1,6 @@
 {
   "name": "suitecrm",
-  "version": "8.3-beta",
+  "version": "8.3.0",
   "scripts": {
     "ng": "ng",
     "start": "npm run start:shell",

programming_language: TypeScript
filename: SugarBean.php
change_type: ModificationType.MODIFY
diff: @@ -6203,6 +6203,11 @@ class SugarBean
         if ($current_user->isAdmin() || !$this->bean_implements('ACL')) {
             return true;
         }
+
+        if (check_default_module_access($this->module_name ?? '') === false) {
+            return false;
+        }
+
         $view = strtolower($view);
         switch ($view) {
             case 'list':

programming_language: PHP
filename: SugarApplication.php
change_type: ModificationType.MODIFY
diff: @@ -301,7 +301,21 @@ class SugarApplication
         if (!empty($_REQUEST['action']) && $_REQUEST['action'] == "RetrieveEmail") {
             return;
         }
-        if (!is_admin($GLOBALS['current_user']) && !empty($GLOBALS['adminOnlyList'][$this->controller->module]) && !empty($GLOBALS['adminOnlyList'][$this->controller->module]['all']) && (empty($GLOBALS['adminOnlyList'][$this->controller->module][$this->controller->action]) || $GLOBALS['adminOnlyList'][$this->controller->module][$this->controller->action] != 'allow')) {
+
+        $module = $this->controller->module ?? '';
+        $action = strtolower($this->controller->action ?? '');
+
+        if (!empty($_REQUEST['import_module'] ?? '') && strtolower($module) === 'import') {
+            $module = $_REQUEST['import_module'] ?? '';
+            $action = 'import';
+        }
+
+        $adminOnlyList = $GLOBALS['adminOnlyList'] ?? [];
+        $adminOnlyModuleActions = $adminOnlyList[$module] ?? [];
+        $adminOnlyAction = $adminOnlyModuleActions[$action] ?? $adminOnlyModuleActions['all'] ?? false;
+        $isAdminOnly = !empty($adminOnlyAction) && $adminOnlyAction !== 'allow';
+
+        if ($isAdminOnly && !is_admin($GLOBALS['current_user'])) {
             $this->controller->hasAccess = false;
             return;
         }
@@ -629,7 +643,7 @@ class SugarApplication
     {
         session_destroy();
     }
-    
+
     /**
      * Redirect to another URL
      *
@@ -643,7 +657,7 @@ class SugarApplication
          * If the headers have been sent, then we cannot send an additional location header
          * so we will output a javascript redirect statement.
          */
-        
+
         if (!empty($_REQUEST['ajax_load'])) {
             ob_get_clean();
             $ajax_ret = array(

programming_language: PHP
filename: function.sugarvar.php
change_type: ModificationType.MODIFY
diff: @@ -17,7 +17,7 @@ r55980 - 2010-04-19 13:31:28 -0700 (Mon, 19 Apr 2010) - kjing - create Mango (6.
 
 r52439 - 2009-11-12 17:05:52 -0800 (Thu, 12 Nov 2009) - clee - Updated to allow Rich Text Editor to resize and render HTML content on detailview.
 
-r51719 - 2009-10-22 10:18:00 -0700 (Thu, 22 Oct 2009) - mitani - Converted to Build 3  tags and updated the build system 
+r51719 - 2009-10-22 10:18:00 -0700 (Thu, 22 Oct 2009) - mitani - Converted to Build 3  tags and updated the build system
 
 r51634 - 2009-10-19 13:32:22 -0700 (Mon, 19 Oct 2009) - mitani - Windex is the branch for Sugar Sales 1.0 development
 
@@ -42,7 +42,7 @@ r22175 - 2007-04-23 16:43:00 -0700 (Mon, 23 Apr 2007) - clee - Latest updates as
 
 r22125 - 2007-04-20 17:02:26 -0700 (Fri, 20 Apr 2007) - majed - makes it so you don't need to pass in as many variables
 
-r22124 - 2007-04-20 16:54:53 -0700 (Fri, 20 Apr 2007) - clee - 
+r22124 - 2007-04-20 16:54:53 -0700 (Fri, 20 Apr 2007) - clee -
 
 */
 
@@ -61,54 +61,60 @@ r22124 - 2007-04-20 16:54:53 -0700 (Fri, 20 Apr 2007) - clee -
  * Name:     sugarvar<br>
  * Purpose:  creates a smarty variable from the parameters
  *
- * @author Wayne Pan {wayne at sugarcrm.com}
  * @param array
  * @param Smarty
+ * @author Wayne Pan {wayne at sugarcrm.com}
  */
 
 function smarty_function_sugarvar($params, &$smarty)
 {
-	if(empty($params['key']))  {
-	    $smarty->trigger_error("sugarvar: missing 'key' parameter");
-	    return;
-	}
-
-	$object = (empty($params['objectName']))?$smarty->get_template_vars('parentFieldArray'): $params['objectName'];
-	$displayParams = $smarty->get_template_vars('displayParams');
-
-
-	if(empty($params['memberName'])){
-		$member = $smarty->get_template_vars('vardef');
-		$member = $member['name'];
-	}else{
-		$members = explode('.', $params['memberName']);
-		$member =  $smarty->get_template_vars($members[0]);
-		for($i = 1; $i < count($members); $i++){
-			$member = $member[$members[$i]];
-		}
-	}
-
-    $_contents =  '$'. $object . '.' . $member . '.' . $params['key'];
-	if(empty($params['stringFormat']) && empty($params['string'])) {
-		$_contents = '{' . $_contents;
-		if(!empty($displayParams['htmlescape'])){
-			$_contents .= '|escape:\'html\'';
-		}
-		if(!empty($params['htmlentitydecode'])){
-			$_contents .= '|escape:\'html_entity_decode\'';
-		}
-		if(!empty($displayParams['strip_tags'])){
-			$_contents .= '|strip_tags';
-		}
-		if(!empty($displayParams['url2html'])){
-			$_contents .= '|url2html';
-		}
-		if(!empty($displayParams['nl2br'])){
-			$_contents .= '|nl2br';
-		}
-
-		$_contents .= '}';
+    if (empty($params['key'])) {
+        $smarty->trigger_error("sugarvar: missing 'key' parameter");
+
+        return;
     }
+
+    $object = (empty($params['objectName'])) ? $smarty->get_template_vars('parentFieldArray') : $params['objectName'];
+    $displayParams = $smarty->get_template_vars('displayParams');
+
+
+    if (empty($params['memberName'])) {
+        $member = $smarty->get_template_vars('vardef');
+        $member = $member['name'];
+    } else {
+        $members = explode('.', $params['memberName']);
+        $member = $smarty->get_template_vars($members[0]);
+        for ($i = 1; $i < count($members); $i++) {
+            $member = $member[$members[$i]];
+        }
+    }
+
+    $_contents = '$' . $object . '.' . $member . '.' . $params['key'];
+    if (empty($params['stringFormat']) && empty($params['string'])) {
+        $_contents = '{' . $_contents;
+        if (!empty($displayParams['htmlescape'])) {
+            $_contents .= '|escape:\'html\'';
+        }
+        if (!empty($params['htmlentitydecode'])) {
+            $_contents .= '|escape:\'html_entity_decode\'';
+        }
+        if (!empty($displayParams['strip_tags'])) {
+            $_contents .= '|strip_tags';
+        }
+        if (!empty($displayParams['url2html'])) {
+            $_contents .= '|url2html';
+        }
+        if (!empty($displayParams['nl2br'])) {
+            $_contents .= '|nl2br';
+        }
+        if (!empty($displayParams['purifyHtml'])) {
+            $_contents .= '|htmlpurify';
+        }
+
+        $_contents .= '}';
+    }
+
     return $_contents;
 }
+
 ?>

programming_language: PHP
filename: modifier.htmlpurify.php
change_type: ModificationType.ADD
diff: @@ -0,0 +1,49 @@
+<?php
+/**
+ * SuiteCRM is a customer relationship management program developed by SalesAgility Ltd.
+ * Copyright (C) 2023 SalesAgility Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Affero General Public License version 3 as published by the
+ * Free Software Foundation with the addition of the following permission added
+ * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
+ * IN WHICH THE COPYRIGHT IS OWNED BY SALESAGILITY, SALESAGILITY DISCLAIMS THE
+ * WARRANTY OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
+ *
+ * This program 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 Affero General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * In accordance with Section 7(b) of the GNU Affero General Public License
+ * version 3, these Appropriate Legal Notices must retain the display of the
+ * "Supercharged by SuiteCRM" logo. If the display of the logos is not reasonably
+ * feasible for technical reasons, the Appropriate Legal Notices must display
+ * the words "Supercharged by SuiteCRM".
+ */
+
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+/**
+ * Smarty HTML purifier modifier plugin
+ *
+ * Type:     modifier<br>
+ * Name:     htmlpurify<br>
+ * Purpose:  purify html to display
+ * @param string
+ * @return string
+ */
+
+function smarty_modifier_htmlpurify($string)
+{
+    $string = purify_html(securexss($string));
+
+    return $string;
+}

programming_language: PHP
filename: SugarFieldText.php
change_type: ModificationType.MODIFY
diff: @@ -56,6 +56,10 @@ class SugarFieldText extends SugarFieldBase
             $displayParams['url2html'] = true;
         }
 
+        if (isset($vardef['editor']) && $vardef['editor'] === "html") {
+            $displayParams['purifyHtml'] = $displayParams['purifyHtml'] ?? true;
+        }
+
         return parent::getDetailViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex);
     }
 
@@ -98,8 +102,11 @@ class SugarFieldText extends SugarFieldBase
             if (!isset($displayParams['htmlescape'])) {
                 $displayParams['htmlescape'] = false;
             }
+            if (isset($vardef['editor']) && $vardef['editor'] === "html") {
+                $displayParams['purifyHtml'] = $displayParams['purifyHtml'] ?? true;
+            }
 
-            if ($_REQUEST['action'] == "EditView") {
+            if ($_REQUEST['action'] === "EditView") {
                 require_once(__DIR__ . "/../../../../include/SugarTinyMCE.php");
                 $tiny = new SugarTinyMCE();
                 $editor = $tiny->getInstance($vardef['name'], 'email_compose_light');

programming_language: PHP
filename: modules.php
change_type: ModificationType.MODIFY
diff: @@ -281,7 +281,7 @@ $modInvisList = [
 
 $adminOnlyList = [
     //module => list of actions  (all says all actions are admin only)
-    //'Administration' => ['all'=>1, 'SupportPortal'=>'allow'],
+    'Administration' => ['all'=>1, 'supportportal'=>'allow'],
     'Dropdown' => ['all' => 1],
     'Dynamic' => ['all' => 1],
     'DynamicFields' => ['all' => 1],
@@ -295,6 +295,10 @@ $adminOnlyList = [
     'UpgradeWizard' => ['all' => 1],
     'Studio' => ['all' => 1],
     'Schedulers' => ['all' => 1],
+    'ExternalOAuthConnection' => ['all' => 1],
+    'jjwg_Address_Cache' => ['all' => 1],
+    'SugarFeed' => ['adminsettings' => 1],
+    'jjwg_Maps' => ['geocoded_counts' => 1, 'geocoding_test' => 1, 'config' => 1],
 ];
 
 $modInvisList[] = 'ACL';

programming_language: PHP
filename: ApiBeanMapper.php
change_type: ModificationType.MODIFY
diff: @@ -36,6 +36,8 @@ require_once __DIR__ . '/TypeMappers/DateTimeMapper.php';
 require_once __DIR__ . '/TypeMappers/DateTimeComboMapper.php';
 require_once __DIR__ . '/TypeMappers/MultiEnumMapper.php';
 require_once __DIR__ . '/TypeMappers/BooleanMapper.php';
+require_once __DIR__ . '/TypeMappers/HtmlMapper.php';
+require_once __DIR__ . '/TypeMappers/TextMapper.php';
 require_once __DIR__ . '/ApiBeanModuleMappers.php';
 require_once __DIR__ . '/ModuleMappers/SavedSearch/SavedSearchMappers.php';
 require_once __DIR__ . '/ModuleMappers/AOP_Case_Updates/CaseUpdatesMappers.php';
@@ -75,6 +77,8 @@ class ApiBeanMapper
         $this->typeMappers[MultiEnumMapper::getType()] = new MultiEnumMapper();
         $this->typeMappers[BooleanMapper::getType()] = new BooleanMapper();
         $this->typeMappers['boolean'] = $this->typeMappers[BooleanMapper::getType()];
+        $this->typeMappers[HtmlMapper::getType()] = new HtmlMapper();
+        $this->typeMappers[TextMapper::getType()] = new TextMapper();
         $this->moduleMappers[SavedSearchMappers::getModule()] = new SavedSearchMappers();
         $this->typeMappers[DateTimeComboMapper::getType()] = new DateTimeMapper();
         $this->linkMappers[EmailAddressLinkMapper::getRelateModule()] = [];

programming_language: PHP
filename: HtmlMapper.php
change_type: ModificationType.ADD
diff: @@ -0,0 +1,82 @@
+<?php
+/**
+ * SuiteCRM is a customer relationship management program developed by SalesAgility Ltd.
+ * Copyright (C) 2023 SalesAgility Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Affero General Public License version 3 as published by the
+ * Free Software Foundation with the addition of the following permission added
+ * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
+ * IN WHICH THE COPYRIGHT IS OWNED BY SALESAGILITY, SALESAGILITY DISCLAIMS THE
+ * WARRANTY OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
+ *
+ * This program 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 Affero General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see http://www.gnu.org/licenses.
+ *
+ * In accordance with Section 7(b) of the GNU Affero General Public License
+ * version 3, these Appropriate Legal Notices must retain the display of the
+ * "Supercharged by SuiteCRM" logo. If the display of the logos is not reasonably
+ * feasible for technical reasons, the Appropriate Legal Notices must display
+ * the words "Supercharged by SuiteCRM".
+ */
+
+require_once __DIR__ . '/TypeMapperInterface.php';
+
+class HtmlMapper implements TypeMapperInterface
+{
+    /**
+     * @inheritDoc
+     */
+    public static function getType(): string
+    {
+        return 'html';
+    }
+
+    /**
+     * @inheritDoc
+     */
+    public function toApi(SugarBean $bean, array &$container, string $name, string $alternativeName = ''): void
+    {
+        $newName = $name;
+
+        if (!empty($alternativeName)) {
+            $newName = $alternativeName;
+        }
+
+        if (empty($bean->$name)) {
+            $container[$newName] = '';
+
+            return;
+        }
+
+        $container[$newName] = $bean->$name;
+    }
+
+    /**
+     * @inheritDoc
+     */
+    public function toBean(SugarBean $bean, array &$container, string $name, string $alternativeName = ''): void
+    {
+        $newName = $name;
+
+        if (!empty($alternativeName)) {
+            $newName = $alternativeName;
+        }
+
+        $fieldDef = $bean->field_defs[$newName] ?? [];
+
+        $purifyHtml = $fieldDef['metadata']['purifyHtml'] ?? true;
+        $value = $container[$newName] ?? '';
+
+        if ($purifyHtml === false || empty($value) || !is_string($value)) {
+            return;
+        }
+
+        $container[$newName] = purify_html(securexss($value));
+    }
+}

programming_language: PHP
filename: TextMapper.php
change_type: ModificationType.ADD
diff: @@ -0,0 +1,82 @@
+<?php
+/**
+ * SuiteCRM is a customer relationship management program developed by SalesAgility Ltd.
+ * Copyright (C) 2023 SalesAgility Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Affero General Public License version 3 as published by the
+ * Free Software Foundation with the addition of the following permission added
+ * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
+ * IN WHICH THE COPYRIGHT IS OWNED BY SALESAGILITY, SALESAGILITY DISCLAIMS THE
+ * WARRANTY OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
+ *
+ * This program 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 Affero General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see http://www.gnu.org/licenses.
+ *
+ * In accordance with Section 7(b) of the GNU Affero General Public License
+ * version 3, these Appropriate Legal Notices must retain the display of the
+ * "Supercharged by SuiteCRM" logo. If the display of the logos is not reasonably
+ * feasible for technical reasons, the Appropriate Legal Notices must display
+ * the words "Supercharged by SuiteCRM".
+ */
+
+require_once __DIR__ . '/TypeMapperInterface.php';
+
+class TextMapper implements TypeMapperInterface
+{
+    /**
+     * @inheritDoc
+     */
+    public static function getType(): string
+    {
+        return 'text';
+    }
+
+    /**
+     * @inheritDoc
+     */
+    public function toApi(SugarBean $bean, array &$container, string $name, string $alternativeName = ''): void
+    {
+        $newName = $name;
+
+        if (!empty($alternativeName)) {
+            $newName = $alternativeName;
+        }
+
+        if (empty($bean->$name)) {
+            $container[$newName] = '';
+
+            return;
+        }
+
+        $container[$newName] = $bean->$name;
+    }
+
+    /**
+     * @inheritDoc
+     */
+    public function toBean(SugarBean $bean, array &$container, string $name, string $alternativeName = ''): void
+    {
+        $newName = $name;
+
+        if (!empty($alternativeName)) {
+            $newName = $alternativeName;
+        }
+
+        $fieldDef = $bean->field_defs[$newName] ?? [];
+
+        $editor = $fieldDef['editor'] ?? '';
+        $purifyHtml = $fieldDef['metadata']['purifyHtml'] ?? true;
+
+        if (empty($editor) || $editor !== 'html' || $purifyHtml === false || !is_string($container[$newName] ?? '')) {
+            return;
+        }
+
+        $container[$newName] = purify_html(securexss($container[$newName] ?? ''));
+    }
+}

programming_language: PHP
filename: ListViewDataPort.php
change_type: ModificationType.MODIFY
diff: @@ -618,7 +618,12 @@ class ListViewDataPort extends ListViewData
             $totalCount = $this->getTotalCount($main_query);
         }
 
-        $endOffset = (floor(($totalCount - 1) / $limit)) * $limit;
+        if ($limit > 0) {
+            $endOffset = (floor(($totalCount - 1) / $limit)) * $limit;
+        } else {
+            $endOffset = 0;
+        }
+
         $pageData['ordering'] = $order;
         $pageData['ordering']['sortOrder'] = $this->getReverseSortOrder($pageData['ordering']['sortOrder']);
         //get url parameters as an array

programming_language: PHP
filename: AddContactsToTargetListService.php
change_type: ModificationType.MODIFY
diff: @@ -109,6 +109,16 @@ class AddContactsToTargetListService
             $bean->retrieve($id);
             $contacts = $bean->get_linked_beans('contacts', 'Contacts3');
             foreach ($contacts as $contact) {
+
+                if (empty($contact)) {
+                    continue;
+                }
+
+                $hasAccess = $contact->ACLAccess('view');
+                if (!$hasAccess) {
+                    continue;
+                }
+
                 $relationship = $contact->load_relationship($sanitizedModuleName);
 
                 if (!$relationship) {

programming_language: PHP
filename: utils.php
change_type: ModificationType.MODIFY
diff: @@ -292,6 +292,10 @@ function make_sugar_config(&$sugar_config)
         'strict_id_validation' => false,
         'legacy_email_behaviour' => false,
         'snooze_alert_timer' => 600,
+        'default_module_access' => [
+            'SecurityGroups' => false,
+            'AOW_WorkFlow' => false
+        ],
     );
 }
 
@@ -592,6 +596,10 @@ function get_sugar_config_defaults(): array
         ],
         'legacy_email_behaviour' => false,
         'snooze_alert_timer' => 600,
+        'default_module_access' => [
+            'SecurityGroups' => false,
+            'AOW_WorkFlow' => false,
+        ],
     ];
 
     if (!is_object($locale)) {
@@ -6217,12 +6225,58 @@ function has_group_action_acls_defined(string $module, string $action): bool
     return $hasGroupActionAcls;
 }
 
+/**
+ * Check if user has action acls defined
+ * @param string $module
+ * @param string $action
+ * @return bool
+ */
+function has_action_acls_defined(string $module, string $action): bool
+{
+    global $current_user;
+
+    $hasGroupActionAcls = true;
+
+    $aclActions = ACLAction::getUserActions($current_user->id, false, $module, 'module', $action);
+    $isDefaultListACL = !empty($aclActions['isDefault']) && isTrue($aclActions['isDefault']);
+
+    if (empty($aclActions) || $isDefaultListACL) {
+        $hasGroupActionAcls = false;
+    }
+
+    return $hasGroupActionAcls;
+}
+
+/**
+ * Check default module access
+ * @param string $module
+ * @return bool
+ */
+function check_default_module_access(string $module): bool
+{
+    global $sugar_config, $current_user;
+
+    if (empty($module) || is_admin($current_user)) {
+        return true;
+    }
+
+    $hasActionAclsDefined = has_action_acls_defined($module, 'access');
+    $defaultModuleAccessConfig = $sugar_config['default_module_access'] ?? [];
+    $defaultModuleAccess = $defaultModuleAccessConfig[$module] ?? true;
+    if ($defaultModuleAccess === false && isFalse($hasActionAclsDefined ?? false)) {
+        return false;
+    }
+
+    return true;
+}
+
 /**
  * Check if is value is smtp in a case-insensitive way
  * @param $value
  * @return bool
  */
-function isSmtp($value): bool {
+function isSmtp($value): bool
+{
     if (empty($value) || !is_string($value)) {
         return false;
     }

programming_language: PHP
filename: SugarFeedDashlet.php
change_type: ModificationType.MODIFY
diff: @@ -282,13 +282,13 @@ class SugarFeedDashlet extends DashletGeneric
             '".$current_user->id."' = (select assigned_user_id from ".$mod_bean->table_name." where id = sugarfeed.related_id)
         OR  EXISTS (SELECT  1
                   FROM    securitygroups secg
-                          INNER JOIN securitygroups_users secu 
-                            ON secg.id = secu.securitygroup_id 
-                               AND secu.deleted = 0 
+                          INNER JOIN securitygroups_users secu
+                            ON secg.id = secu.securitygroup_id
+                               AND secu.deleted = 0
                                AND secu.user_id = '".$current_user->id."'
-                          INNER JOIN securitygroups_records secr 
-                            ON secg.id = secr.securitygroup_id 
-                               AND secr.deleted = 0 
+                          INNER JOIN securitygroups_records secr
+                            ON secg.id = secr.securitygroup_id
+                               AND secr.deleted = 0
                                AND secr.module = '".$module."'
                        WHERE   secr.record_id = sugarfeed.related_id
                                AND secg.deleted = 0)
@@ -594,9 +594,23 @@ enableQS(false);
         /* BEGIN - SECURITY GROUPS */
         //hide links for those that shouldn't have one
         $listview = preg_replace('/\[(\w+)\:([\w\-\d]*)\:([^\]]*)\]\[HIDELINK\]/', '$3', $listview);
-        /* END - SECURITY GROUPS */ 
-        $listview = preg_replace('/\[(\w+)\:([\w\-\d]*)\:([^\]]*)\]/', '<a href="index.php?module=$1&action=DetailView&record=$2"><img src="themes/default/images/$1.gif" border=0 REPLACE_ALT>$3</a>', $listview); /*SKIP_IMAGE_TAG*/
+        /* END - SECURITY GROUPS */
 
+        require_once 'include/portability/RouteConverter.php';
+        $routeConverter = new RouteConverter();
+
+        $listview = preg_replace_callback(
+            '/\[(\w+)\:([\w\-\d]*)\:([^\]]*)\]/',
+            static function (&$matches) use ($routeConverter) {
+                $module = $matches[1] ?? '';
+                $record = $matches[2] ?? '';
+                $name = $matches[3] ?? '';
+                $uiLink = str_replace('./', '../', $routeConverter->convert($module, 'DetailView', $record, []));
+
+                return '<a href="' . $uiLink . '">' . $name . '</a>';
+            },
+            $listview
+        );/*SKIP_IMAGE_TAG*/
 
         //process each module for the singular version so we can populate the alt tag on the image
         $altStrings = array();
@@ -659,7 +673,7 @@ enableQS(false);
             // The user feed system isn't enabled, don't let them post notes
             return '';
         }
-        
+
         $user_name = ucfirst($GLOBALS['current_user']->user_name);
         $moreimg = SugarThemeRegistry::current()->getImage('advanced_search', 'onclick="toggleDisplay(\'more_' . $this->id . '\'); toggleDisplay(\'more_img_'.$this->id.'\'); toggleDisplay(\'less_img_'.$this->id.'\');"', null, null, '.gif', translate('LBL_SHOW_MORE_OPTIONS', 'SugarFeed'));
         $lessimg = SugarThemeRegistry::current()->getImage('basic_search', 'onclick="toggleDisplay(\'more_' . $this->id . '\'); toggleDisplay(\'more_img_'.$this->id.'\'); toggleDisplay(\'less_img_'.$this->id.'\');"', null, null, '.gif', translate('LBL_HIDE_OPTIONS', 'SugarFeed'));

programming_language: PHP