YetiForceCompany/YetiForceCRM

View on GitHub
app/PrivilegeQuery.php

Summary

Maintainability
C
1 day
Test Coverage
F
23%

Function getPrivilegeQuery has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
Open

    public static function getPrivilegeQuery(Db\Query $query, $moduleName, $user = false, $relatedRecord = null)
    {
        if ($user && $user instanceof User) {
            $userId = $user->getId();
        } elseif (!$user) {
Severity: Minor
Found in app/PrivilegeQuery.php - About 6 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 getPrivilegeQuery has 84 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function getPrivilegeQuery(Db\Query $query, $moduleName, $user = false, $relatedRecord = null)
    {
        if ($user && $user instanceof User) {
            $userId = $user->getId();
        } elseif (!$user) {
Severity: Major
Found in app/PrivilegeQuery.php - About 3 hrs to fix

    The method getPrivilegeQuery() has an NPath complexity of 77088. The configured NPath complexity threshold is 200.
    Open

        public static function getPrivilegeQuery(Db\Query $query, $moduleName, $user = false, $relatedRecord = null)
        {
            if ($user && $user instanceof User) {
                $userId = $user->getId();
            } elseif (!$user) {
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpmd

    NPathComplexity

    Since: 0.1

    The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

    Example

    class Foo {
        function bar() {
            // lots of complicated code
        }
    }

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

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

        public static function getPrivilegeQuery(Db\Query $query, $moduleName, $user = false, $relatedRecord = null)
        {
            if ($user && $user instanceof User) {
                $userId = $user->getId();
            } elseif (!$user) {
    Severity: Minor
    Found in app/PrivilegeQuery.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 45 to the 15 allowed.
    Open

        public static function getPrivilegeQuery(Db\Query $query, $moduleName, $user = false, $relatedRecord = null)
    Severity: Critical
    Found in app/PrivilegeQuery.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 getConditions has a boolean flag argument $user, which is a certain sign of a Single Responsibility Principle violation.
    Open

        public static function getConditions(Db\Query $query, string $moduleName, $user = false, $relatedRecord = null)
    Severity: Minor
    Found in app/PrivilegeQuery.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

    Missing class import via use statement (line '127', column '24').
    Open

                            $subQuery = (new \App\Db\Query())->select(['shareduserid'])
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpmd

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

    Source http://phpmd.org/rules/cleancode.html#MissingImport

    Missing class import via use statement (line '114', column '22').
    Open

                    $subQuery = (new \App\Db\Query())->select(['userid'])
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpmd

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

    Source http://phpmd.org/rules/cleancode.html#MissingImport

    Missing class import via use statement (line '133', column '24').
    Open

                            $subQuery = (new \App\Db\Query())->select(['sharedgroupid'])
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpmd

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

    Source http://phpmd.org/rules/cleancode.html#MissingImport

    Missing class import via use statement (line '78', column '22').
    Open

                    $subQuery = (new \App\Db\Query())->select(['crmid'])->distinct()
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpmd

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

    Source http://phpmd.org/rules/cleancode.html#MissingImport

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

        public static function getPrivilegeQuery(Db\Query $query, $moduleName, $user = false, $relatedRecord = null)
    Severity: Minor
    Found in app/PrivilegeQuery.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

    Missing class import via use statement (line '141', column '22').
    Open

                    $subQuery = (new \App\Db\Query())->select(['crmid'])->distinct()
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpmd

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

    Source http://phpmd.org/rules/cleancode.html#MissingImport

    Avoid using static access to class '\Users_Privileges_Model' in method 'getPrivilegeQuery'.
    Open

            $userModel = \Users_Privileges_Model::getInstanceById($userId);
    Severity: Minor
    Found in app/PrivilegeQuery.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 'getPrivilegeQuery'.
    Open

                if (\App\Config::security('PERMITTED_BY_ROLES')) {
    Severity: Minor
    Found in app/PrivilegeQuery.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 'getPrivilegeQuery'.
    Open

            if (!$userModel->isAdminUser() && \App\Config::security('PERMITTED_BY_PRIVATE_FIELD') && ($fieldInfo = \App\Field::getFieldInfo('private', $moduleName)) && \in_array($fieldInfo['presence'], [0, 2])) {
    Severity: Minor
    Found in app/PrivilegeQuery.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 'getPrivilegeQuery'.
    Open

                if (\App\Config::security('PERMITTED_BY_SHARED_OWNERS')) {
    Severity: Minor
    Found in app/PrivilegeQuery.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 'getPrivilegeQuery'.
    Open

                if (\App\Config::security('PERMITTED_BY_SHARING')) {
    Severity: Minor
    Found in app/PrivilegeQuery.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 assigning values to variables in if clauses and the like (line '72', column '93').
    Open

        public static function getPrivilegeQuery(Db\Query $query, $moduleName, $user = false, $relatedRecord = null)
        {
            if ($user && $user instanceof User) {
                $userId = $user->getId();
            } elseif (!$user) {
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpmd

    IfStatementAssignment

    Since: 2.7.0

    Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

    Example

    class Foo
    {
        public function bar($flag)
        {
            if ($foo = 'bar') { // possible typo
                // ...
            }
            if ($baz = 0) { // always false
                // ...
            }
        }
    }

    Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

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

                    $sharingPrivileges = \App\User::getSharingFile($userId);
    Severity: Minor
    Found in app/PrivilegeQuery.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\Field' in method 'getPrivilegeQuery'.
    Open

            if (!$userModel->isAdminUser() && \App\Config::security('PERMITTED_BY_PRIVATE_FIELD') && ($fieldInfo = \App\Field::getFieldInfo('private', $moduleName)) && \in_array($fieldInfo['presence'], [0, 2])) {
    Severity: Minor
    Found in app/PrivilegeQuery.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 'getPrivilegeQuery'.
    Open

                    $recordMetaData = \vtlib\Functions::getCRMRecordMetadata($relatedRecord);
    Severity: Minor
    Found in app/PrivilegeQuery.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 'getPrivilegeQuery'.
    Open

                if (($modules = \App\Config::security('permittedModulesByCreatorField')) && \in_array($moduleName, $modules)) {
    Severity: Minor
    Found in app/PrivilegeQuery.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\Module' in method 'getPrivilegeQuery'.
    Open

            $tabId = Module::getModuleId($moduleName);
    Severity: Minor
    Found in app/PrivilegeQuery.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 '\Users_Privileges_Model' in method 'getPrivilegeQuery'.
    Open

                    $parentRecord = \Users_Privileges_Model::getParentRecord($relatedRecord, false, $role->get('listrelatedrecord'));
    Severity: Minor
    Found in app/PrivilegeQuery.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 'getPrivilegeQuery'.
    Open

                if (\App\Config::security('PERMITTED_BY_SHARED_OWNERS')) {
    Severity: Minor
    Found in app/PrivilegeQuery.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 'getPrivilegeQuery'.
    Open

            if (\App\Config::security('PERMITTED_BY_RECORD_HIERARCHY') && !empty($relatedRecord)) {
    Severity: Minor
    Found in app/PrivilegeQuery.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 assigning values to variables in if clauses and the like (line '109', column '9').
    Open

        public static function getPrivilegeQuery(Db\Query $query, $moduleName, $user = false, $relatedRecord = null)
        {
            if ($user && $user instanceof User) {
                $userId = $user->getId();
            } elseif (!$user) {
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpmd

    IfStatementAssignment

    Since: 2.7.0

    Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

    Example

    class Foo
    {
        public function bar($flag)
        {
            if ($foo = 'bar') { // possible typo
                // ...
            }
            if ($baz = 0) { // always false
                // ...
            }
        }
    }

    Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

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

                $userId = \App\User::getCurrentUserId();
    Severity: Minor
    Found in app/PrivilegeQuery.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 'getPrivilegeQuery'.
    Open

                    $recordPermission = Privilege::isPermitted($recordMetaData['setype'], 'DetailView', $relatedRecord, $userId);
    Severity: Minor
    Found in app/PrivilegeQuery.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 "listrelatedrecord" 3 times.
    Open

                if (2 == $role->get('listrelatedrecord')) {
    Severity: Critical
    Found in app/PrivilegeQuery.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 "vtiger_crmentity.smownerid" 6 times.
    Open

                $subConditions = ['or', ['vtiger_crmentity.smownerid' => $owners]];
    Severity: Critical
    Found in app/PrivilegeQuery.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" 5 times.
    Open

                        ->where(['userid' => $owners]);
    Severity: Critical
    Found in app/PrivilegeQuery.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.

    Argument 1 (userId) is null but \Users_Privileges_Model::getInstanceById() takes int defined at /code/modules/Users/models/Privileges.php:159
    Open

            $userModel = \Users_Privileges_Model::getInstanceById($userId);
    Severity: Minor
    Found in app/PrivilegeQuery.php by phan

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

                $query->andWhere($conditions);
    Severity: Critical
    Found in app/PrivilegeQuery.php by phan

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

                    $subQuery = (new \App\Db\Query())->select(['userid'])
    Severity: Critical
    Found in app/PrivilegeQuery.php by phan

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

                $userId = $user->getId();
    Severity: Critical
    Found in app/PrivilegeQuery.php by phan

    Returning type '' but getPrivilegeQuery() is declared to return void
    Open

                        return '';
    Severity: Minor
    Found in app/PrivilegeQuery.php by phan

    Checking instanceof against undeclared class \App\User (Did you mean class \Tests\App\User)
    Open

            if ($user && $user instanceof User) {
    Severity: Critical
    Found in app/PrivilegeQuery.php by phan

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

                    $subQuery = (new \App\Db\Query())->select(['crmid'])->distinct()
    Severity: Critical
    Found in app/PrivilegeQuery.php by phan

    Parameter $user has undeclared type \App\User (Did you mean class \Tests\App\User)
    Open

        public static function getPrivilegeQuery(Db\Query $query, $moduleName, $user = false, $relatedRecord = null)
    Severity: Minor
    Found in app/PrivilegeQuery.php by phan

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

        public static function getConditions(Db\Query $query, string $moduleName, $user = false, $relatedRecord = null)
    Severity: Minor
    Found in app/PrivilegeQuery.php by phan

    Reference to undeclared property \Users_Privileges_Model->groups
    Open

                if (!empty($userModel->groups)) {
    Severity: Minor
    Found in app/PrivilegeQuery.php by phan

    Reference to undeclared property \Users_Privileges_Model->profile_global_permission
    Open

            if (!$userModel->isAdminUser() && 1 == $userModel->profile_global_permission[1] && 1 == $userModel->profile_global_permission[2] && 3 === ($userModel->defaultOrgSharingPermission[$tabId] ?? null)) {
    Severity: Minor
    Found in app/PrivilegeQuery.php by phan

    Reference to undeclared property \Users_Privileges_Model->parent_role_seq
    Open

                    $parentRoleSeq = $userModel->parent_role_seq;
    Severity: Minor
    Found in app/PrivilegeQuery.php by phan

    Reference to undeclared property \Users_Privileges_Model->groups
    Open

                $owners = array_merge([$userId], $userModel->groups);
    Severity: Minor
    Found in app/PrivilegeQuery.php by phan

    Reference to undeclared property \Users_Privileges_Model->defaultOrgSharingPermission
    Open

            if (!$userModel->isAdminUser() && 1 == $userModel->profile_global_permission[1] && 1 == $userModel->profile_global_permission[2] && 3 === ($userModel->defaultOrgSharingPermission[$tabId] ?? null)) {
    Severity: Minor
    Found in app/PrivilegeQuery.php by phan

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

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

    Reference to undeclared property \Users_Privileges_Model->groups
    Open

                    $conditions[] = ['vtiger_crmentity.smownerid' => $userModel->groups];
    Severity: Minor
    Found in app/PrivilegeQuery.php by phan

    Default value for \App\User|int $user can't be false
    Open

        public static function getPrivilegeQuery(Db\Query $query, $moduleName, $user = false, $relatedRecord = null)
    Severity: Minor
    Found in app/PrivilegeQuery.php by phan

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

                            $subQuery = (new \App\Db\Query())->select(['sharedgroupid'])
    Severity: Critical
    Found in app/PrivilegeQuery.php by phan

    Reference to undeclared property \Users_Privileges_Model->groups
    Open

                        ->where(['userid' => array_merge([$userId], $userModel->groups)]);
    Severity: Minor
    Found in app/PrivilegeQuery.php by phan

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

                    $sharingPrivileges = \App\User::getSharingFile($userId);
    Severity: Critical
    Found in app/PrivilegeQuery.php by phan

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

                            $subQuery = (new \App\Db\Query())->select(['shareduserid'])
    Severity: Critical
    Found in app/PrivilegeQuery.php by phan

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

                    $subQuery = (new \App\Db\Query())->select(['crmid'])->distinct()
    Severity: Critical
    Found in app/PrivilegeQuery.php by phan

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

                    $query->andWhere($conditions);
    Severity: Critical
    Found in app/PrivilegeQuery.php by phan

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

                        $sharingPrivilegesModule = $sharingPrivileges['permission'][$moduleName];
    Severity: Minor
    Found in app/PrivilegeQuery.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

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

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

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

                $subConditions = ['or', ['vtiger_crmentity.smownerid' => $owners]];
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

                $role = $userModel->getRoleDetail();
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

                        $relatedRecord = $parentRecord;
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

                    $recordMetaData = \vtlib\Functions::getCRMRecordMetadata($relatedRecord);
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

                    $recordPermission = Privilege::isPermitted($recordMetaData['setype'], 'DetailView', $relatedRecord, $userId);
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

                if (($modules = \App\Config::security('permittedModulesByCreatorField')) && \in_array($moduleName, $modules)) {
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

                if (\App\Config::security('PERMITTED_BY_SHARING')) {
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

                    $subQuery = (new \App\Db\Query())->select(['crmid'])->distinct()
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

                    $conditions[] = ['vtiger_crmentity.crmid' => $subQuery];
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

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

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

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

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

                if (!empty($userModel->groups)) {
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

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

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

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

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

                    $sharingPrivileges = \App\User::getSharingFile($userId);
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

                        if (!empty($sharingRuleInfo['ROLE'])) {
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

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

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

                    $query->andWhere($conditions);
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

        public static function getPrivilegeQuery(Db\Query $query, $moduleName, $user = false, $relatedRecord = null)
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

                $owners = array_merge([$userId], $userModel->groups);
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

                $conditions[] = ['and', ['vtiger_crmentity.private' => 1], $subConditions];
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

                $conditions[] = ['vtiger_crmentity.smownerid' => $userId];
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

                        ->where(['like', 'vtiger_role.parentrole', "$parentRoleSeq::%", false]);
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

                        ->from('u_yf_crmentity_showners')
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

         * Interpreter for privilege.
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

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

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

        public static function setPermissionInterpreter(string $className)
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

            static::getPrivilegeQuery($query, $moduleName, $user, $relatedRecord);
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

         * @param \App\Db\Query $query
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

         * @return void
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

            if (!$userModel->isAdminUser() && \App\Config::security('PERMITTED_BY_PRIVATE_FIELD') && ($fieldInfo = \App\Field::getFieldInfo('private', $moduleName)) && \in_array($fieldInfo['presence'], [0, 2])) {
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

                $conditions[] = ['vtiger_crmentity.private' => 0];
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

            $tabId = Module::getModuleId($moduleName);
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

                                ->where(['userid' => $userId, 'tabid' => $tabId]);
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

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

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

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

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

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

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

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

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

                if (2 == $role->get('listrelatedrecord')) {
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

                        ->innerJoin('vtiger_users', 'vtiger_user2role.userid = vtiger_users.id')
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

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

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

                            $subQuery = (new \App\Db\Query())->select(['shareduserid'])
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

                        if (!empty($sharingRuleInfo['GROUP'])) {
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

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

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

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

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

                $conditions = ['or'];
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

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

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

                if (0 != $role->get('listrelatedrecord')) {
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

                                ->from('vtiger_tmp_read_group_sharing_per')
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

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

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

        private static $interpreter;
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

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

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

            if (!empty(static::$interpreter) && class_exists(static::$interpreter)) {
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

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

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

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

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

                    $conditions[] = ['vtiger_crmentity.smownerid' => $userModel->groups];
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

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

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

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

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

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

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

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

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

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

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

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

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

            } elseif (!$user) {
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

                if (\App\Config::security('PERMITTED_BY_SHARED_OWNERS')) {
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

    Line exceeds 120 characters; contains 208 characters
    Open

            if (!$userModel->isAdminUser() && \App\Config::security('PERMITTED_BY_PRIVATE_FIELD') && ($fieldInfo = \App\Field::getFieldInfo('private', $moduleName)) && \in_array($fieldInfo['presence'], [0, 2])) {
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

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

    Line exceeds 120 characters; contains 129 characters
    Open

                    $parentRecord = \Users_Privileges_Model::getParentRecord($relatedRecord, false, $role->get('listrelatedrecord'));
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

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

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

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

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

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

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

                    if (isset($sharingPrivileges['permission'][$moduleName])) {
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

                        return '';
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

                            $subQuery = (new \App\Db\Query())->select(['sharedgroupid'])
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

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

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

            if (!$userModel->isAdminUser() && 1 == $userModel->profile_global_permission[1] && 1 == $userModel->profile_global_permission[2] && 3 === ($userModel->defaultOrgSharingPermission[$tabId] ?? null)) {
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

                    $subQuery = (new \App\Db\Query())->select(['userid'])
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

         * @var string
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

            static::$interpreter = $className;
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

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

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

                return (static::$interpreter)::getConditions($query, $moduleName, $user, $relatedRecord);
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

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

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

                        ->from('u_yf_crmentity_showners')
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

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

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

                $conditions = ['or'];
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

                    $conditions[] = ['vtiger_crmentity.smownerid' => $subQuery];
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

         * Sets interpreter.
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

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

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

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

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

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

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

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

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

         * @param int|\App\User $user
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

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

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

                    $subConditions[] = ['vtiger_crmentity.crmid' => $subQuery];
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

                    $parentRecord = \Users_Privileges_Model::getParentRecord($relatedRecord, false, $role->get('listrelatedrecord'));
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

                                ->where(['userid' => $userId, 'tabid' => $tabId]);
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

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

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

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

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

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

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

         * Undocumented function.
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

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

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

        public static function getConditions(Db\Query $query, string $moduleName, $user = false, $relatedRecord = null)
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

            if ($user && $user instanceof User) {
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

            $userModel = \Users_Privileges_Model::getInstanceById($userId);
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

                    $subQuery = (new \App\Db\Query())->select(['crmid'])->distinct()
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

    Line exceeds 120 characters; contains 206 characters
    Open

            if (!$userModel->isAdminUser() && 1 == $userModel->profile_global_permission[1] && 1 == $userModel->profile_global_permission[2] && 3 === ($userModel->defaultOrgSharingPermission[$tabId] ?? null)) {
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

                    $conditions[] = ['vtiger_crmentity.smcreatorid' => $userId];
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

                        ->from('vtiger_user2role')
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

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

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

                if (\App\Config::security('PERMITTED_BY_SHARED_OWNERS')) {
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

                        ->where(['userid' => array_merge([$userId], $userModel->groups)]);
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

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

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

         * @return void
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

         * @return void
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

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

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

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

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

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

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

         * Undocumented function.
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

                $userId = $user->getId();
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

    Line exceeds 120 characters; contains 123 characters
    Open

                if (($modules = \App\Config::security('permittedModulesByCreatorField')) && \in_array($moduleName, $modules)) {
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

                        $sharingRuleInfo = $sharingPrivilegesModule['read'];
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

                        ->where(['userid' => $owners]);
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

                $query->andWhere($conditions);
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

                                ->from('vtiger_tmp_read_user_sharing_per')
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

                            $conditions[] = ['vtiger_crmentity.smownerid' => $subQuery];
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

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

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

         * @param \App\Db\Query $query
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

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

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

                if (\App\Config::security('PERMITTED_BY_ROLES')) {
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

                        $sharingPrivilegesModule = $sharingPrivileges['permission'][$moduleName];
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

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

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

            if (\App\Config::security('PERMITTED_BY_RECORD_HIERARCHY') && !empty($relatedRecord)) {
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

    Line exceeds 120 characters; contains 125 characters
    Open

                    $recordPermission = Privilege::isPermitted($recordMetaData['setype'], 'DetailView', $relatedRecord, $userId);
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

                    $parentRoleSeq = $userModel->parent_role_seq;
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

                            $conditions[] = ['vtiger_crmentity.smownerid' => $subQuery];
    Severity: Minor
    Found in app/PrivilegeQuery.php by phpcodesniffer

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

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

    There are no issues that match your filters.

    Category
    Status