YetiForceCompany/YetiForceCRM

View on GitHub
app/PrivilegeUpdater.php

Summary

Maintainability
B
4 hrs
Test Coverage
D
68%

Function setUpdater has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    public static function setUpdater($moduleName, $record = false, $priority = false, $type = 1)
    {
        $params = [
            'module' => $moduleName,
            'type' => $type,
Severity: Minor
Found in app/PrivilegeUpdater.php - About 2 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method setUpdater has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function setUpdater($moduleName, $record = false, $priority = false, $type = 1)
    {
        $params = [
            'module' => $moduleName,
            'type' => $type,
Severity: Minor
Found in app/PrivilegeUpdater.php - About 1 hr to fix

    Function update has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function update($record, $moduleName)
        {
            $searchUsers = $recordAccessUsers = '';
            $users = Fields\Owner::getUsersIds();
            $searchable = isset(\App\RecordSearch::getSearchableModules()[$moduleName]);
    Severity: Minor
    Found in app/PrivilegeUpdater.php - About 35 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    The method setUpdater() has a Cyclomatic Complexity of 12. The configured cyclomatic complexity threshold is 10.
    Open

        public static function setUpdater($moduleName, $record = false, $priority = false, $type = 1)
        {
            $params = [
                'module' => $moduleName,
                'type' => $type,
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpmd

    CyclomaticComplexity

    Since: 0.1

    Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

    Example

    // Cyclomatic Complexity = 11
    class Foo {
    1   public function example() {
    2       if ($a == $b) {
    3           if ($a1 == $b1) {
                    fiddle();
    4           } elseif ($a2 == $b2) {
                    fiddle();
                } else {
                    fiddle();
                }
    5       } elseif ($c == $d) {
    6           while ($c == $d) {
                    fiddle();
                }
    7        } elseif ($e == $f) {
    8           for ($n = 0; $n < $h; $n++) {
                    fiddle();
                }
            } else {
                switch ($z) {
    9               case 1:
                        fiddle();
                        break;
    10              case 2:
                        fiddle();
                        break;
    11              case 3:
                        fiddle();
                        break;
                    default:
                        fiddle();
                        break;
                }
            }
        }
    }

    Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

    Refactor this function to reduce its Cognitive Complexity from 18 to the 15 allowed.
    Open

        public static function setUpdater($moduleName, $record = false, $priority = false, $type = 1)
    Severity: Critical
    Found in app/PrivilegeUpdater.php by sonar-php

    Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

    See

    The method setUpdater has a boolean flag argument $record, which is a certain sign of a Single Responsibility Principle violation.
    Open

        public static function setUpdater($moduleName, $record = false, $priority = false, $type = 1)
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpmd

    BooleanArgumentFlag

    Since: 1.4.0

    A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

    Example

    class Foo {
        public function bar($flag = true) {
        }
    }

    Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

    The method checkGlobalSearchPermissions has a boolean flag argument $userId, which is a certain sign of a Single Responsibility Principle violation.
    Open

        public static function checkGlobalSearchPermissions($moduleName, $userId = false)
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpmd

    BooleanArgumentFlag

    Since: 1.4.0

    A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

    Example

    class Foo {
        public function bar($flag = true) {
        }
    }

    Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

    The method setUpdater has a boolean flag argument $priority, which is a certain sign of a Single Responsibility Principle violation.
    Open

        public static function setUpdater($moduleName, $record = false, $priority = false, $type = 1)
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpmd

    BooleanArgumentFlag

    Since: 1.4.0

    A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

    Example

    class Foo {
        public function bar($flag = true) {
        }
    }

    Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

    Avoid using static access to class 'App\Privilege' in method 'update'.
    Open

                if (Privilege::isPermitted($moduleName, 'DetailView', $record, $userId)) {
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpmd

    StaticAccess

    Since: 1.4.0

    Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

    Example

    class Foo
    {
        public function bar()
        {
            Bar::baz();
        }
    }

    Source https://phpmd.org/rules/cleancode.html#staticaccess

    Avoid using static access to class 'App\Fields\Owner' in method 'updateRecordAccess'.
    Open

            $users = Fields\Owner::getUsersIds();
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpmd

    StaticAccess

    Since: 1.4.0

    Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

    Example

    class Foo
    {
        public function bar()
        {
            Bar::baz();
        }
    }

    Source https://phpmd.org/rules/cleancode.html#staticaccess

    Avoid using static access to class 'App\User' in method 'checkGlobalSearchPermissions'.
    Open

                $userId = User::getCurrentUserId();
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpmd

    StaticAccess

    Since: 1.4.0

    Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

    Example

    class Foo
    {
        public function bar()
        {
            Bar::baz();
        }
    }

    Source https://phpmd.org/rules/cleancode.html#staticaccess

    Avoid using static access to class '\vtlib\Functions' in method 'setAllUpdater'.
    Open

            $modules = \vtlib\Functions::getAllModules();
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpmd

    StaticAccess

    Since: 1.4.0

    Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

    Example

    class Foo
    {
        public function bar()
        {
            Bar::baz();
        }
    }

    Source https://phpmd.org/rules/cleancode.html#staticaccess

    Avoid using static access to class 'App\Config' in method 'updateOnRecordSave'.
    Open

            if (!Config::security('CACHING_PERMISSION_TO_RECORD')) {
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpmd

    StaticAccess

    Since: 1.4.0

    Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

    Example

    class Foo
    {
        public function bar()
        {
            Bar::baz();
        }
    }

    Source https://phpmd.org/rules/cleancode.html#staticaccess

    Avoid using static access to class 'App\Config' in method 'setAllUpdater'.
    Open

            if (Config::module('ModTracker', 'WATCHDOG')) {
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpmd

    StaticAccess

    Since: 1.4.0

    Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

    Example

    class Foo
    {
        public function bar()
        {
            Bar::baz();
        }
    }

    Source https://phpmd.org/rules/cleancode.html#staticaccess

    Avoid using static access to class '\App\RecordSearch' in method 'update'.
    Open

    }
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpmd

    StaticAccess

    Since: 1.4.0

    Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

    Example

    class Foo
    {
        public function bar()
        {
            Bar::baz();
        }
    }

    Source https://phpmd.org/rules/cleancode.html#staticaccess

    Avoid using static access to class 'App\Privilege' in method 'updateSearch'.
    Open

                if (static::checkGlobalSearchPermissions($moduleName, $userId) || Privilege::isPermitted($moduleName, 'DetailView', $record, $userId)) {
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpmd

    StaticAccess

    Since: 1.4.0

    Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

    Example

    class Foo
    {
        public function bar()
        {
            Bar::baz();
        }
    }

    Source https://phpmd.org/rules/cleancode.html#staticaccess

    Avoid using static access to class 'App\Privilege' in method 'updateRecordAccess'.
    Open

                if (Privilege::isPermitted($moduleName, 'DetailView', $record, $userId)) {
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpmd

    StaticAccess

    Since: 1.4.0

    Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

    Example

    class Foo
    {
        public function bar()
        {
            Bar::baz();
        }
    }

    Source https://phpmd.org/rules/cleancode.html#staticaccess

    Avoid using static access to class 'App\Fields\Owner' in method 'update'.
    Open

            $users = Fields\Owner::getUsersIds();
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpmd

    StaticAccess

    Since: 1.4.0

    Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

    Example

    class Foo
    {
        public function bar()
        {
            Bar::baz();
        }
    }

    Source https://phpmd.org/rules/cleancode.html#staticaccess

    Avoid using static access to class 'App\Fields\Owner' in method 'updateSearch'.
    Open

            $users = Fields\Owner::getUsersIds();
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpmd

    StaticAccess

    Since: 1.4.0

    Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

    Example

    class Foo
    {
        public function bar()
        {
            Bar::baz();
        }
    }

    Source https://phpmd.org/rules/cleancode.html#staticaccess

    Avoid using static access to class 'App\Db' in method 'setUpdater'.
    Open

            $db = Db::getInstance('admin');
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpmd

    StaticAccess

    Since: 1.4.0

    Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

    Example

    class Foo
    {
        public function bar()
        {
            Bar::baz();
        }
    }

    Source https://phpmd.org/rules/cleancode.html#staticaccess

    Avoid using static access to class 'App\Cache' in method 'setAllUpdater'.
    Open

            Cache::clear();
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpmd

    StaticAccess

    Since: 1.4.0

    Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

    Example

    class Foo
    {
        public function bar()
        {
            Bar::baz();
        }
    }

    Source https://phpmd.org/rules/cleancode.html#staticaccess

    Avoid using static access to class '\Vtiger_Watchdog_Model' in method 'setAllUpdater'.
    Open

                \Vtiger_Watchdog_Model::reloadCache();
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpmd

    StaticAccess

    Since: 1.4.0

    Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

    Example

    class Foo
    {
        public function bar()
        {
            Bar::baz();
        }
    }

    Source https://phpmd.org/rules/cleancode.html#staticaccess

    The method setUpdater uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
    Open

            } else {
                $row = $query->from('s_#__privileges_updater')->where(['module' => $moduleName, 'type' => 0, 'crmid' => $record])->limit(1)->one();
                if (false === $row) {
                    $insert = true;
                    $params['type'] = 0;
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpmd

    ElseExpression

    Since: 1.4.0

    An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

    Example

    class Foo
    {
        public function bar($flag)
        {
            if ($flag) {
                // one branch
            } else {
                // another branch
            }
        }
    }

    Source https://phpmd.org/rules/cleancode.html#elseexpression

    Avoid using static access to class 'App\PrivilegeAdvanced' in method 'setAllUpdater'.
    Open

            PrivilegeAdvanced::reloadCache();
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpmd

    StaticAccess

    Since: 1.4.0

    Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

    Example

    class Foo
    {
        public function bar()
        {
            Bar::baz();
        }
    }

    Source https://phpmd.org/rules/cleancode.html#staticaccess

    Define a constant instead of duplicating this literal "s_#__privileges_updater" 5 times.
    Open

            $row = $query->from('s_#__privileges_updater')->where(['module' => $moduleName, 'type' => 1])->limit(1)->one();
    Severity: Critical
    Found in app/PrivilegeUpdater.php by sonar-php

    Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

    On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

    Noncompliant Code Example

    With the default threshold of 3:

    function run() {
      prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
      execute('action1');
      release('action1');
    }
    

    Compliant Solution

    ACTION_1 = 'action1';
    
    function run() {
      prepare(ACTION_1);
      execute(ACTION_1);
      release(ACTION_1);
    }
    

    Exceptions

    To prevent generating some false-positives, literals having less than 5 characters are excluded.

    Define a constant instead of duplicating this literal "userid" 4 times.
    Open

                $dataReader = (new Db\Query())->select(['userid', 'searchunpriv'])->from('vtiger_user2role')
    Severity: Critical
    Found in app/PrivilegeUpdater.php by sonar-php

    Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

    On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

    Noncompliant Code Example

    With the default threshold of 3:

    function run() {
      prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
      execute('action1');
      release('action1');
    }
    

    Compliant Solution

    ACTION_1 = 'action1';
    
    function run() {
      prepare(ACTION_1);
      execute(ACTION_1);
      release(ACTION_1);
    }
    

    Exceptions

    To prevent generating some false-positives, literals having less than 5 characters are excluded.

    Define a constant instead of duplicating this literal "crmid" 9 times.
    Open

            $createCommand->update('vtiger_crmentity', ['users' => $recordAccessUsers], ['crmid' => $record])->execute();
    Severity: Critical
    Found in app/PrivilegeUpdater.php by sonar-php

    Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

    On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

    Noncompliant Code Example

    With the default threshold of 3:

    function run() {
      prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
      execute('action1');
      release('action1');
    }
    

    Compliant Solution

    ACTION_1 = 'action1';
    
    function run() {
      prepare(ACTION_1);
      execute(ACTION_1);
      release(ACTION_1);
    }
    

    Exceptions

    To prevent generating some false-positives, literals having less than 5 characters are excluded.

    Define a constant instead of duplicating this literal "module" 5 times.
    Open

                'module' => $moduleName,
    Severity: Critical
    Found in app/PrivilegeUpdater.php by sonar-php

    Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

    On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

    Noncompliant Code Example

    With the default threshold of 3:

    function run() {
      prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
      execute('action1');
      release('action1');
    }
    

    Compliant Solution

    ACTION_1 = 'action1';
    
    function run() {
      prepare(ACTION_1);
      execute(ACTION_1);
      release(ACTION_1);
    }
    

    Exceptions

    To prevent generating some false-positives, literals having less than 5 characters are excluded.

    Define a constant instead of duplicating this literal "DetailView" 3 times.
    Open

                if (Privilege::isPermitted($moduleName, 'DetailView', $record, $userId)) {
    Severity: Critical
    Found in app/PrivilegeUpdater.php by sonar-php

    Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

    On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

    Noncompliant Code Example

    With the default threshold of 3:

    function run() {
      prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
      execute('action1');
      release('action1');
    }
    

    Compliant Solution

    ACTION_1 = 'action1';
    
    function run() {
      prepare(ACTION_1);
      execute(ACTION_1);
      release(ACTION_1);
    }
    

    Exceptions

    To prevent generating some false-positives, literals having less than 5 characters are excluded.

    Call to undeclared method \App\Db\Query::select
    Open

                $dataReader = (new Db\Query())->select(['userid', 'searchunpriv'])->from('vtiger_user2role')
    Severity: Critical
    Found in app/PrivilegeUpdater.php by phan

    Call to method getCurrentUserId from undeclared class \App\User (Did you mean class \Tests\App\User)
    Open

                $userId = User::getCurrentUserId();
    Severity: Critical
    Found in app/PrivilegeUpdater.php by phan

    Call to undeclared method \App\Db\Query::from
    Open

                $row = $query->from('s_#__privileges_updater')->where(['module' => $moduleName, 'type' => 0, 'crmid' => $record])->limit(1)->one();
    Severity: Critical
    Found in app/PrivilegeUpdater.php by phan

    Suspicious array access to false
    Open

                    static::$globalSearchUsersCache[$row['userid']] = explode(',', $row['searchunpriv']);
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phan

    Default value for int $record can't be false
    Open

        public static function setUpdater($moduleName, $record = false, $priority = false, $type = 1)
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phan

    Assigning array{} to property but \App\PrivilegeUpdater::$globalSearchUsersCache is false
    Open

                static::$globalSearchUsersCache = [];
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phan

    Call to method getUsersIds from undeclared class \App\Fields\Owner
    Open

            $users = Fields\Owner::getUsersIds();
    Severity: Critical
    Found in app/PrivilegeUpdater.php by phan

    Call to undeclared method \App\Db::createCommand
    Open

            $createCommand = Db::getInstance()->createCommand();
    Severity: Critical
    Found in app/PrivilegeUpdater.php by phan

    Call to undeclared method \App\Db::createCommand
    Open

            Db::getInstance()->createCommand()
    Severity: Critical
    Found in app/PrivilegeUpdater.php by phan

    Default value for int $priority can't be false
    Open

        public static function setUpdater($moduleName, $record = false, $priority = false, $type = 1)
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phan

    Call to method getUsersIds from undeclared class \App\Fields\Owner
    Open

            $users = Fields\Owner::getUsersIds();
    Severity: Critical
    Found in app/PrivilegeUpdater.php by phan

    Call to undeclared method \App\Db::createCommand
    Open

            Db::getInstance()->createCommand()
    Severity: Critical
    Found in app/PrivilegeUpdater.php by phan

    Call to undeclared method \App\Db\Query::from
    Open

            $row = $query->from('s_#__privileges_updater')->where(['module' => $moduleName, 'type' => 1])->limit(1)->one();
    Severity: Critical
    Found in app/PrivilegeUpdater.php by phan

    Returning type false but getGlobalSearchUsers() is declared to return array
    Open

            return static::$globalSearchUsersCache;
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phan

    Call to method getUsersIds from undeclared class \App\Fields\Owner
    Open

            $users = Fields\Owner::getUsersIds();
    Severity: Critical
    Found in app/PrivilegeUpdater.php by phan

    Call to undeclared method \App\Db::createCommand
    Open

                $db->createCommand()->update('s_#__privileges_updater', $params, ['module' => $moduleName, 'type' => $type])->execute();
    Severity: Critical
    Found in app/PrivilegeUpdater.php by phan

    Call to undeclared method \App\Db\Query::from
    Open

                    $row = $query->from('s_#__privileges_updater')->where(['module' => $moduleName, 'type' => 0, 'crmid' => $record])->limit(1)->one();
    Severity: Critical
    Found in app/PrivilegeUpdater.php by phan

    Call to undeclared method \App\Db::createCommand
    Open

                $db->createCommand()->insert('s_#__privileges_updater', $params)->execute();
    Severity: Critical
    Found in app/PrivilegeUpdater.php by phan

    Default value for int $userId can't be false
    Open

        public static function checkGlobalSearchPermissions($moduleName, $userId = false)
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phan

    Assigning array<int>[]</int> to property but \App\PrivilegeUpdater::$globalSearchUsersCache is false
    Open

                    static::$globalSearchUsersCache[$row['userid']] = explode(',', $row['searchunpriv']);
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phan

    Avoid excessively long variable names like $globalSearchPermissionsCache. Keep variable name length under 20.
    Open

        private static $globalSearchPermissionsCache = [];
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpmd

    LongVariable

    Since: 0.2

    Detects when a field, formal or local variable is declared with a long name.

    Example

    class Something {
        protected $reallyLongIntName = -3; // VIOLATION - Field
        public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
            $otherReallyLongName = -5; // VIOLATION - Local
            for ($interestingIntIndex = 0; // VIOLATION - For
                 $interestingIntIndex < 10;
                 $interestingIntIndex++ ) {
            }
        }
    }

    Source https://phpmd.org/rules/naming.html#longvariable

    Avoid excessively long variable names like $globalSearchUsersCache. Keep variable name length under 20.
    Open

        private static $globalSearchUsersCache = false;
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpmd

    LongVariable

    Since: 0.2

    Detects when a field, formal or local variable is declared with a long name.

    Example

    class Something {
        protected $reallyLongIntName = -3; // VIOLATION - Field
        public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
            $otherReallyLongName = -5; // VIOLATION - Local
            for ($interestingIntIndex = 0; // VIOLATION - For
                 $interestingIntIndex < 10;
                 $interestingIntIndex++ ) {
            }
        }
    }

    Source https://phpmd.org/rules/naming.html#longvariable

    Avoid variables with short names like $db. Configured minimum length is 3.
    Open

            $db = Db::getInstance('admin');
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpmd

    ShortVariable

    Since: 0.2

    Detects when a field, local, or parameter has a very short name.

    Example

    class Something {
        private $q = 15; // VIOLATION - Field
        public static function main( array $as ) { // VIOLATION - Formal
            $r = 20 + $this->q; // VIOLATION - Local
            for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                $r += $this->q;
            }
        }
    }

    Source https://phpmd.org/rules/naming.html#shortvariable

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $createCommand = Db::getInstance()->createCommand();
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $return = false;
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    $return = true;
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            }
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        {
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        {
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @param int    $record
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        }
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * Updating permissions to records.
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                if (static::checkGlobalSearchPermissions($moduleName, $userId) || Privilege::isPermitted($moduleName, 'DetailView', $record, $userId)) {
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            }
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                ->update('vtiger_crmentity', [
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @param int    $priority
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                'type' => $type,
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $users = Fields\Owner::getUsersIds();
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            }
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    $searchUsers .= ',' . $userId;
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            foreach ($users as $userId) {
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                }
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $recordAccessUsers .= ',';
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    'users' => $recordAccessUsers,
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        }
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $params['priority'] = $priority;
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            if ($row) {
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * Checking if user can search globally.
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            if (!isset(static::$globalSearchPermissionsCache[$userId][$moduleName])) {
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            }
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        private static $globalSearchUsersCache = false;
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $searchUsers = $recordAccessUsers = '';
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Line exceeds 120 characters; contains 148 characters
    Open

                if (static::checkGlobalSearchPermissions($moduleName, $userId) || Privilege::isPermitted($moduleName, 'DetailView', $record, $userId)) {
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                }
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @param string $moduleName
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $recordAccessUsers = '';
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                if (isset($users[$userId]) && \in_array($moduleName, $users[$userId])) {
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    ->where(['<>', 'vtiger_role.searchunpriv', ''])
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                ], 'crmid = ' . $record)
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            if (!$userId) {
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                static::$globalSearchUsersCache = [];
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        public static function update($record, $moduleName)
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $searchUsers = '';
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $users = Fields\Owner::getUsersIds();
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @return bool
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        {
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            if (!empty($recordAccessUsers)) {
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Line exceeds 120 characters; contains 127 characters
    Open

                $createCommand->update('u_#__crmentity_search_label', ['userid' => $searchUsers], ['crmid' => $record])->execute();
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            if (!empty($searchUsers)) {
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            }
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            foreach ($users as &$userId) {
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            }
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            Db::getInstance()->createCommand()
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @param string $moduleName Module name
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        {
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $params['crmid'] = $record;
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                if (false === $record) {
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @param int    $userId
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * Loading a list of modules for users with permissions for global search.
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        public static function getGlobalSearchUsers()
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    $searchUsers .= ',' . $userId;
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            if ($searchable) {
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * Updating permissions to global search.
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            ];
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            return static::$globalSearchPermissionsCache[$userId][$moduleName];
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    ->createCommand()->query();
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * Updating permissions to records and global search.
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            foreach ($users as &$userId) {
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            Db::getInstance()->createCommand()
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        {
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            }
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                }
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                }
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                ->execute();
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                'module' => $moduleName,
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $query = new Db\Query();
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        {
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $userId = User::getCurrentUserId();
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            if (!static::$globalSearchUsersCache) {
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $dataReader = (new Db\Query())->select(['userid', 'searchunpriv'])->from('vtiger_user2role')
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                while ($row = $dataReader->read()) {
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    static::$globalSearchUsersCache[$row['userid']] = explode(',', $row['searchunpriv']);
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                }
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                } elseif ($searchable && static::checkGlobalSearchPermissions($moduleName, $userId)) {
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $recordAccessUsers .= ',';
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            if (!empty($recordAccessUsers)) {
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                        $update = true;
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                return static::$globalSearchPermissionsCache[$userId][$moduleName] = $return;
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        }
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            return static::$globalSearchUsersCache;
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        }
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            }
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @param int    $record
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                if (Privilege::isPermitted($moduleName, 'DetailView', $record, $userId)) {
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            if ($record) {
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $insert = $update = $row = false;
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    if (0 != $row['crmid']) {
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        private static $globalSearchPermissionsCache = [];
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $users = static::getGlobalSearchUsers();
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    $recordAccessUsers .= ',' . $userId;
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $searchUsers .= ',';
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @param int    $type
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            if ($priority) {
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    if (false === $row) {
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                static::setUpdater($module['name']);
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        public static function checkGlobalSearchPermissions($moduleName, $userId = false)
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            }
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @return array
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @param string $moduleName
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @param int    $record     If type = 1 starting number if type = 0 record ID
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        public static function setUpdater($moduleName, $record = false, $priority = false, $type = 1)
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    }
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            } elseif (false === $record) {
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                return false;
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @param string $moduleName
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            }
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @param int    $record
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $searchable = isset(\App\RecordSearch::getSearchableModules()[$moduleName]);
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                if (Privilege::isPermitted($moduleName, 'DetailView', $record, $userId)) {
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            }
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $createCommand->update('vtiger_crmentity', ['users' => $recordAccessUsers], ['crmid' => $record])->execute();
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $searchUsers = $searchUsers ? $searchUsers . ',' : $searchUsers;
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $createCommand->update('u_#__crmentity_search_label', ['userid' => $searchUsers], ['crmid' => $record])->execute();
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @param string $moduleName
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $users = Fields\Owner::getUsersIds();
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    $searchUsers .= ',' . $userId;
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                ->update('u_#__crmentity_search_label', ['userid' => $searchUsers], ['crmid' => $record])->execute();
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    $recordAccessUsers .= ',' . $userId;
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * Add to global permissions update queue.
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $modules = \vtlib\Functions::getAllModules();
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                        $insert = true;
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                if (false === $row) {
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            if (Config::module('ModTracker', 'WATCHDOG')) {
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                        $params['crmid'] = 0;
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Line exceeds 120 characters; contains 143 characters
    Open

                $row = $query->from('s_#__privileges_updater')->where(['module' => $moduleName, 'type' => 0, 'crmid' => $record])->limit(1)->one();
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                }
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $db->createCommand()->insert('s_#__privileges_updater', $params)->execute();
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            }
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            if ($update) {
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * Updating permissions to all modules.
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @param \Vtiger_Record_Model $record
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    }
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            foreach ($modules as $module) {
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        public static function updateOnRecordSave(\Vtiger_Record_Model $record)
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            static::setUpdater($record->getModuleName(), $record->getId(), 6, 0);
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                } elseif ($record < $row['crmid']) {
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    $row = $query->from('s_#__privileges_updater')->where(['module' => $moduleName, 'type' => 0, 'crmid' => $record])->limit(1)->one();
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            }
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            if ($insert) {
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Line exceeds 120 characters; contains 147 characters
    Open

                    $row = $query->from('s_#__privileges_updater')->where(['module' => $moduleName, 'type' => 0, 'crmid' => $record])->limit(1)->one();
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            } else {
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    $params['type'] = 0;
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Line exceeds 120 characters; contains 132 characters
    Open

                $db->createCommand()->update('s_#__privileges_updater', $params, ['module' => $moduleName, 'type' => $type])->execute();
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        }
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            Cache::clear();
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * Update permissions while saving record.
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    ->leftJoin('vtiger_role', 'vtiger_user2role.roleid = vtiger_role.roleid')
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            }
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        }
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        public static function updateSearch($record, $moduleName)
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        public static function updateRecordAccess($record, $moduleName)
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $params = [
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $row = $query->from('s_#__privileges_updater')->where(['module' => $moduleName, 'type' => 1])->limit(1)->one();
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $db->createCommand()->update('s_#__privileges_updater', $params, ['module' => $moduleName, 'type' => $type])->execute();
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            if (!Config::security('CACHING_PERMISSION_TO_RECORD')) {
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        }
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        }
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    $insert = true;
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            }
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $insert = true;
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        {
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                \Vtiger_Watchdog_Model::reloadCache();
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            }
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $db = Db::getInstance('admin');
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            }
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        public static function setAllUpdater()
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            PrivilegeAdvanced::reloadCache();
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                }
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $row = $query->from('s_#__privileges_updater')->where(['module' => $moduleName, 'type' => 0, 'crmid' => $record])->limit(1)->one();
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        {
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            }
    Severity: Minor
    Found in app/PrivilegeUpdater.php by phpcodesniffer

    There are no issues that match your filters.

    Category
    Status