YetiForceCompany/YetiForceCRM

View on GitHub
modules/PermissionInspector/models/Module.php

Summary

Maintainability
A
2 hrs
Test Coverage
D
67%

Function getPrivileges has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public function getPrivileges($userId)
    {
        $recordId = false;
        if (!empty($this->get('sourceRecord'))) {
            $recordId = $this->get('sourceRecord');
Severity: Minor
Found in modules/PermissionInspector/models/Module.php - About 1 hr 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 getPrivileges has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function getPrivileges($userId)
    {
        $recordId = false;
        if (!empty($this->get('sourceRecord'))) {
            $recordId = $this->get('sourceRecord');
Severity: Minor
Found in modules/PermissionInspector/models/Module.php - About 1 hr to fix

    Avoid using static access to class '\App\Language' in method 'getPrivileges'.
    Open

                        $profileNames[] = \App\Language::translate($profile->getName(), 'Settings::Profiles');

    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 'getParameters'.
    Open

                    $metadata = \vtlib\Functions::getCRMRecordMetadata($this->get('sourceRecord'));

    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 'getWatchdog'.
    Open

                $watchdog = Vtiger_Watchdog_Model::getInstanceById($this->get('sourceRecord'), $this->get('sourceModule'), $userId);

    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\Log' in method 'getPrivileges'.
    Open

                        \App\Log::error('LBL_PROFILE_DOES_NOT_EXIST: ' . $profileId);

    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 'getPrivileges'.
    Open

                        'isPermitted' => \App\Privilege::isPermitted($this->get('sourceModule'), $action, $recordId, $userId),

    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 'getParameters'.
    Open

                    $privileges['param'] = \App\Language::translate(\App\Fields\Owner::getLabel($metadata['smownerid']));

    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 'getWatchdog'.
    Open

                $watchdog = Vtiger_Watchdog_Model::getInstance($this->get('sourceModule'), $userId);

    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\Language' in method 'getParameters'.
    Open

                    $privileges['param'] = \App\Language::translate(\App\Fields\Owner::getLabel($metadata['smownerid']));

    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\Language' in method 'getParameters'.
    Open

                    $privileges['param'] = \App\Language::translate(\App\Fields\Owner::getLabel($metadata['smownerid']));

    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 'getPrivileges'.
    Open

            $userModel = \App\User::getUserModel($userId);

    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 getPrivileges uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
    Open

                    } else {
                        $profileNames[] = \App\Language::translate('LBL_PROFILE_DOES_NOT_EXIST', 'Settings::Profiles') . ':' . $profileId;
                        \App\Log::error('LBL_PROFILE_DOES_NOT_EXIST: ' . $profileId);
                    }

    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 '\vtlib\Functions' in method 'getParameters'.
    Open

                    $metadata = \vtlib\Functions::getCRMRecordMetadata($this->get('sourceRecord'));

    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 'getParameters'.
    Open

                    $privileges['param'] = \App\Language::translate(\App\Fields\Owner::getLabel($metadata['smownerid']));

    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 'getUsersPermission'.
    Open

            $fieldOwner = \App\Fields\Owner::getInstance($this->get('sourceModule'));

    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\Language' in method 'getPrivileges'.
    Open

                        $profileNames[] = \App\Language::translate('LBL_PROFILE_DOES_NOT_EXIST', 'Settings::Profiles') . ':' . $profileId;

    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\Log' in method 'getPrivileges'.
    Open

                    \App\Log::error($th->__toString(), 'PermissionInspector');

    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 '47', column '9').
    Open

        public function getPrivileges($userId)
        {
            $recordId = false;
            if (!empty($this->get('sourceRecord'))) {
                $recordId = $this->get('sourceRecord');

    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 assigning values to variables in if clauses and the like (line '45', column '22').
    Open

        public function getPrivileges($userId)
        {
            $recordId = false;
            if (!empty($this->get('sourceRecord'))) {
                $recordId = $this->get('sourceRecord');

    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 'Settings_Profiles_Record_Model' in method 'getPrivileges'.
    Open

                    if ($profile = Settings_Profiles_Record_Model::getInstanceById($profileId)) {

    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 getWatchdog uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
    Open

            } else {
                $watchdog = Vtiger_Watchdog_Model::getInstanceById($this->get('sourceRecord'), $this->get('sourceModule'), $userId);
                $watchdog->remove('isWatchingRecord');
                $watchdog->remove('isWatchingModule');
                $active = $watchdog->isWatchingRecord();

    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

    Define a constant instead of duplicating this literal "sourceRecord" 6 times.
    Open

            if (!empty($this->get('sourceRecord'))) {

    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 "param" 3 times.
    Open

                        'param' => $th->getMessage(),

    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 "sourceModule" 4 times.
    Open

            $fieldOwner = \App\Fields\Owner::getInstance($this->get('sourceModule'));

    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 method getInstance from undeclared class \App\Fields\Owner
    Open

            $fieldOwner = \App\Fields\Owner::getInstance($this->get('sourceModule'));

    Call to method error from undeclared class \App\Log
    Open

                        \App\Log::error('LBL_PROFILE_DOES_NOT_EXIST: ' . $profileId);

    Call to method error from undeclared class \App\Log
    Open

                    \App\Log::error($th->__toString(), 'PermissionInspector');

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

                    $privileges['param'] = \App\Language::translate(\App\Fields\Owner::getLabel($metadata['smownerid']));

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

            $userModel = \App\User::getUserModel($userId);

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

                    $privileges['param'] = \App\Language::translate(\App\Fields\Owner::getLabel($metadata['smownerid']));

    This case's code block is the same as the block for the case on line 85.
    Open

                case 'SEC_RECORD_OWNER_CURRENT_USER':
                    $metadata = \vtlib\Functions::getCRMRecordMetadata($this->get('sourceRecord'));
                    $privileges['param'] = \App\Language::translate(\App\Fields\Owner::getLabel($metadata['smownerid']));
                    break;

    Having two cases in a switch statement or two branches in an if chain with the same implementation is at best duplicate code, and at worst a coding error. If the same logic is truly needed for both instances, then in an if chain they should be combined, or for a switch, one should fall through to the other.

    Noncompliant Code Example

    switch ($i) {
      case 1:
        doSomething();
        break;
      case 2:
        doSomethingDifferent();
        break;
      case 3:  // Noncompliant; duplicates case 1's implementation
        doSomething();
        break;
      default:
        doTheRest();
    }
    
    if ($a >= 0 && $a < 10) {
      doTheThing();
    else if ($a >= 10 && $a < 20) {
      doTheOtherThing();
    }
    else if ($a >= 20 && $a < 50) {
      doTheThing();  // Noncompliant; duplicates first condition
    }
    else {
      doTheRest();
    }
    
    if ($b == 0) {
      doOneMoreThing();
    }
    else {
      doOneMoreThing(); // Noncompliant; duplicates then-branch
    }
    
    var b = a ? 12 > 4 : 4;  // Noncompliant; always results in the same value
    

    Compliant Solution

    switch ($i) {
      case 1:
      case 3:
        doSomething();
        break;
      case 2:
        doSomethingDifferent();
        break;
      default:
        doTheRest();
    }
    
    if (($a >= 0 && $a < 10) || ($a >= 20 && $a < 50)) {
      doTheThing();
    else if ($a >= 10 && $a < 20) {
      doTheOtherThing();
    }
    else {
      doTheRest();
    }
    
    doOneMoreThing();
    
    b = 4;
    

    or

    switch ($i) {
      case 1:
        doSomething();
        break;
      case 2:
        doSomethingDifferent();
        break;
      case 3:
        doThirdThing();
        break;
      default:
        doTheRest();
    }
    
    if ($a >= 0 && $a < 10) {
      doTheThing();
    else if ($a >= 10 && $a < 20) {
      doTheOtherThing();
    }
    else if ($a >= 20 && $a < 50) {
      doTheThirdThing();
    }
    else {
      doTheRest();
    }
    
    if ($b == 0) {
      doOneMoreThing();
    }
    else {
      doTheRest();
    }
    
    int b = a ? 12 > 4 : 8;
    

    Exceptions

    Blocks in an if chain that contain a single line of code are ignored, as are blocks in a switch statement that contain a single line of code with or without a following break.

    Each class must be in a namespace of at least one level (a top-level vendor name)
    Open

    class PermissionInspector_Module_Model extends Vtiger_Module_Model

    The class PermissionInspector_Module_Model is not named in CamelCase.
    Open

    class PermissionInspector_Module_Model extends Vtiger_Module_Model
    {
        /**
         * Get users permissions.
         *

    CamelCaseClassName

    Since: 0.2

    It is considered best practice to use the CamelCase notation to name classes.

    Example

    class class_name {
    }

    Source

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

            }

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

            $profileNames = [];

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

                    \App\Log::error($th->__toString(), 'PermissionInspector');

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

                        'isPermitted' => false,

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

            $list = [];

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

         *

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

                        'profiles' => implode(',', $profileNames),

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

                $list[$userId] = [

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

         *

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

         */

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

        public function getPrivileges($userId)

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

                        'param' => $th->getMessage(),

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

                        \App\Log::error('LBL_PROFILE_DOES_NOT_EXIST: ' . $profileId);

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

        /**

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

                foreach ($profiles as $profileId) {

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

                        'isPermitted' => \App\Privilege::isPermitted($this->get('sourceModule'), $action, $recordId, $userId),

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

                    ]);

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

                    'privileges' => $this->getPrivileges($userId),

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

                    if ($profile = Settings_Profiles_Record_Model::getInstanceById($profileId)) {

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

                    $privileges['param'] = \App\Language::translate(\App\Fields\Owner::getLabel($metadata['smownerid']));

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

                $watchdog->remove('isWatchingRecord');

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

         * @param int $userId

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

            }

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

         *

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

            switch ($privileges['accessLog']) {

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

        public function getWatchdog($userId)

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

                ];

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

            return $list;

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

         * Get privileges by user id.

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

         *

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

                case 'SEC_RECORD_OWNER_CURRENT_GROUP':

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

            return $privileges;

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

                    'watchdog' => $this->getWatchdog($userId),

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

                        $profileNames[] = \App\Language::translate('LBL_PROFILE_DOES_NOT_EXIST', 'Settings::Profiles') . ':' . $profileId;

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

                    $permissions[$action] = $this->getParameters([

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

        public function getParameters($privileges)

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

                    $privileges['param'] = \App\Language::translate(\App\Fields\Owner::getLabel($metadata['smownerid']));

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

         */

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

            }

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

                    } else {

    Line exceeds 120 characters; contains 122 characters
    Open

                        'isPermitted' => \App\Privilege::isPermitted($this->get('sourceModule'), $action, $recordId, $userId),

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

            return $permissions;

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

                $watchdog = Vtiger_Watchdog_Model::getInstance($this->get('sourceModule'), $userId);

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

            return ['active' => $active];

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

            foreach ($fieldOwner->getAccessibleUsers() as $userId => $userName) {

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

        {

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

                }

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

                case 'SEC_RECORD_OWNER_CURRENT_USER':

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

        }

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

         * Get watchdog by user id.

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

         *

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

         * Get users permissions.

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

         *

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

        public function getUsersPermission()

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

        {

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

            $fieldOwner = \App\Fields\Owner::getInstance($this->get('sourceModule'));

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

                    'userName' => $userName,

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

         * @return array

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

            if ($userModel && ($profiles = $userModel->getProfiles())) {

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

                        'profiles' => implode(',', $profileNames),

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

         * @param int $userId

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

                $watchdog = Vtiger_Watchdog_Model::getInstanceById($this->get('sourceRecord'), $this->get('sourceModule'), $userId);

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

                $watchdog->remove('isWatchingModule');

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

                $active = $watchdog->isWatchingRecord();

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

         * @return array

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

                    }

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

                try {

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

                        'accessLog' => \App\Privilege::$isPermittedLevel,

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

        {

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

            } else {

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

         * @return array

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

                    break;

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

                    break;

    Line exceeds 120 characters; contains 128 characters
    Open

                $watchdog = Vtiger_Watchdog_Model::getInstanceById($this->get('sourceRecord'), $this->get('sourceModule'), $userId);

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

                    ];

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

        }

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

            $recordId = false;

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

            if (!empty($this->get('sourceRecord'))) {

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

                $recordId = $this->get('sourceRecord');

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

            $permissions = [];

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

            foreach ($this->get('actions') as $action) {

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

                    $permissions[$action] = [

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

                }

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

         * @param array $privileges

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

            }

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

         *

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

         */

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

                default:

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

                    break;

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

        /**

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

                $active = $watchdog->isWatchingModule();

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

        /**

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

                        $profileNames[] = \App\Language::translate($profile->getName(), 'Settings::Profiles');

    Line exceeds 120 characters; contains 134 characters
    Open

                        $profileNames[] = \App\Language::translate('LBL_PROFILE_DOES_NOT_EXIST', 'Settings::Profiles') . ':' . $profileId;

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

        }

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

         */

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

                    $metadata = \vtlib\Functions::getCRMRecordMetadata($this->get('sourceRecord'));

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

            if (empty($this->get('sourceRecord'))) {

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

        }

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

            $userModel = \App\User::getUserModel($userId);

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

                } catch (\Throwable $th) {

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

        /**

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

            }

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

         * Get additional parameters.

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

                    $metadata = \vtlib\Functions::getCRMRecordMetadata($this->get('sourceRecord'));

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

         * @return array

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

        {

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

                $watchdog->remove('isWatchingModule');

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

            }

    Class name "PermissionInspector_Module_Model" is not in camel caps format
    Open

    class PermissionInspector_Module_Model extends Vtiger_Module_Model

    There are no issues that match your filters.

    Category
    Status