YetiForceCompany/YetiForceCRM

View on GitHub
modules/Users/models/Privileges.php

Summary

Maintainability
F
3 days
Test Coverage
F
30%

Function getParentRecord has a Cognitive Complexity of 73 (exceeds 5 allowed). Consider refactoring.
Open

    public static function getParentRecord($record, $moduleName = false, $type = 1, $actionid = false)
    {
        $cacheKey = "$record,$moduleName,$type,$actionid";
        if (\App\Cache::staticHas('PrivilegesParentRecord', $cacheKey)) {
            return \App\Cache::staticGet('PrivilegesParentRecord', $cacheKey);
Severity: Minor
Found in modules/Users/models/Privileges.php - About 1 day 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 getParentRecord has 119 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function getParentRecord($record, $moduleName = false, $type = 1, $actionid = false)
    {
        $cacheKey = "$record,$moduleName,$type,$actionid";
        if (\App\Cache::staticHas('PrivilegesParentRecord', $cacheKey)) {
            return \App\Cache::staticGet('PrivilegesParentRecord', $cacheKey);
Severity: Major
Found in modules/Users/models/Privileges.php - About 4 hrs to fix

    The class Users_Privileges_Model has an overall complexity of 97 which is very high. The configured complexity threshold is 50.
    Open

    class Users_Privileges_Model extends Users_Record_Model
    {
        /**
         * Function to get the Display Name for the record.
         *
    Severity: Minor
    Found in modules/Users/models/Privileges.php by phpmd

    File Privileges.php has 296 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /* +***********************************************************************************
     * The contents of this file are subject to the vtiger CRM Public License Version 1.0
     * ("License"); You may not use this file except in compliance with the License
     * The Original Code is:  vtiger CRM Open Source
    Severity: Minor
    Found in modules/Users/models/Privileges.php - About 3 hrs to fix

      Function setSharedOwner has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function setSharedOwner($userIds, $record)
          {
              $saveFull = true;
              $db = \App\Db::getInstance();
              if ('SaveAjax' == \App\Request::_get('action') && \App\Request::_has('field') && 'shownerid' != \App\Request::_get('field')) {
      Severity: Minor
      Found in modules/Users/models/Privileges.php - About 55 mins to fix

      Cognitive Complexity

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

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

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

      Further reading

      Function checkLockEdit has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function checkLockEdit($moduleName, Vtiger_Record_Model $recordModel)
          {
              $recordId = $recordModel->getId();
              if (isset(self::$lockEditCache[$moduleName . $recordId])) {
                  return self::$lockEditCache[$moduleName . $recordId];
      Severity: Minor
      Found in modules/Users/models/Privileges.php - About 45 mins to fix

      Cognitive Complexity

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

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

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

      Further reading

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

          public function hasModuleActionPermission($mixed, $action)
          {
              if (!is_a($action, 'Vtiger_Action_Model')) {
                  $action = Vtiger_Action_Model::getInstance($action);
              }
      Severity: Minor
      Found in modules/Users/models/Privileges.php - About 35 mins to fix

      Cognitive Complexity

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

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

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

      Further reading

      The method getParentRecord() has an NPath complexity of 1212. The configured NPath complexity threshold is 200.
      Open

          public static function getParentRecord($record, $moduleName = false, $type = 1, $actionid = false)
          {
              $cacheKey = "$record,$moduleName,$type,$actionid";
              if (\App\Cache::staticHas('PrivilegesParentRecord', $cacheKey)) {
                  return \App\Cache::staticGet('PrivilegesParentRecord', $cacheKey);
      Severity: Minor
      Found in modules/Users/models/Privileges.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 getParentRecord() has 124 lines of code. Current threshold is set to 100. Avoid really long methods.
      Open

          public static function getParentRecord($record, $moduleName = false, $type = 1, $actionid = false)
          {
              $cacheKey = "$record,$moduleName,$type,$actionid";
              if (\App\Cache::staticHas('PrivilegesParentRecord', $cacheKey)) {
                  return \App\Cache::staticGet('PrivilegesParentRecord', $cacheKey);
      Severity: Minor
      Found in modules/Users/models/Privileges.php by phpmd

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

          public static function getParentRecord($record, $moduleName = false, $type = 1, $actionid = false)
          {
              $cacheKey = "$record,$moduleName,$type,$actionid";
              if (\App\Cache::staticHas('PrivilegesParentRecord', $cacheKey)) {
                  return \App\Cache::staticGet('PrivilegesParentRecord', $cacheKey);
      Severity: Minor
      Found in modules/Users/models/Privileges.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 83 to the 15 allowed.
      Open

          public static function getParentRecord($record, $moduleName = false, $type = 1, $actionid = false)
      Severity: Critical
      Found in modules/Users/models/Privileges.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 class Users_Privileges_Model has a coupling between objects value of 20. Consider to reduce the number of dependencies under 13.
      Open

      class Users_Privileges_Model extends Users_Record_Model
      {
          /**
           * Function to get the Display Name for the record.
           *
      Severity: Minor
      Found in modules/Users/models/Privileges.php by phpmd

      CouplingBetweenObjects

      Since: 1.1.0

      A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability

      Example

      class Foo {
          /**
           * @var \foo\bar\X
           */
          private $x = null;
      
          /**
           * @var \foo\bar\Y
           */
          private $y = null;
      
          /**
           * @var \foo\bar\Z
           */
          private $z = null;
      
          public function setFoo(\Foo $foo) {}
          public function setBar(\Bar $bar) {}
          public function setBaz(\Baz $baz) {}
      
          /**
           * @return \SplObjectStorage
           * @throws \OutOfRangeException
           * @throws \InvalidArgumentException
           * @throws \ErrorException
           */
          public function process(\Iterator $it) {}
      
          // ...
      }

      Source https://phpmd.org/rules/design.html#couplingbetweenobjects

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

          public static function getParentRecord($record, $moduleName = false, $type = 1, $actionid = false)
      Severity: Minor
      Found in modules/Users/models/Privileges.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 '202', column '21').
      Open

              $workflows = (new VTWorkflowManager())->getWorkflowsForModule($moduleName, VTWorkflowManager::$BLOCK_EDIT);
      Severity: Minor
      Found in modules/Users/models/Privileges.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 getParentRecord has a boolean flag argument $moduleName, which is a certain sign of a Single Responsibility Principle violation.
      Open

          public static function getParentRecord($record, $moduleName = false, $type = 1, $actionid = false)
      Severity: Minor
      Found in modules/Users/models/Privileges.php by phpmd

      BooleanArgumentFlag

      Since: 1.4.0

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

      Example

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

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

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

          public static function clearCache($userId = false)
      Severity: Minor
      Found in modules/Users/models/Privileges.php by phpmd

      BooleanArgumentFlag

      Since: 1.4.0

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

      Example

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

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

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

          public static function isPermittedByUserId($userId, $moduleName, $actionName = '', $record = false)
      Severity: Minor
      Found in modules/Users/models/Privileges.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 '325', column '23').
      Open

                  $dataReader = (new \App\Db\Query())->select(['relcrmid', 'crmid'])
      Severity: Minor
      Found in modules/Users/models/Privileges.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 '369', column '23').
      Open

                  $dataReader = (new \App\Db\Query())->select(['crmid' => $relationInfo['rel']])->from($relationInfo['table'])
      Severity: Minor
      Found in modules/Users/models/Privileges.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 assigning values to variables in if clauses and the like (line '303', column '7').
      Open

          public static function getParentRecord($record, $moduleName = false, $type = 1, $actionid = false)
          {
              $cacheKey = "$record,$moduleName,$type,$actionid";
              if (\App\Cache::staticHas('PrivilegesParentRecord', $cacheKey)) {
                  return \App\Cache::staticGet('PrivilegesParentRecord', $cacheKey);
      Severity: Minor
      Found in modules/Users/models/Privileges.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\ModuleHierarchy' in method 'getParentRecord'.
      Open

              } elseif (\in_array($moduleName, \App\ModuleHierarchy::getModulesMapMMBase())) {
      Severity: Minor
      Found in modules/Users/models/Privileges.php by phpmd

      StaticAccess

      Since: 1.4.0

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

      Example

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

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

      Avoid using static access to class 'Vtiger_Action_Model' in method 'hasModuleActionPermission'.
      Open

                  $action = Vtiger_Action_Model::getInstance($action);
      Severity: Minor
      Found in modules/Users/models/Privileges.php by phpmd

      StaticAccess

      Since: 1.4.0

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

      Example

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

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

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

              $valueMap = App\User::getPrivilegesFile($userId);
      Severity: Minor
      Found in modules/Users/models/Privileges.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\Request' in method 'setSharedOwner'.
      Open

              if ('SaveAjax' == \App\Request::_get('action') && \App\Request::_has('field') && 'shownerid' != \App\Request::_get('field')) {
      Severity: Minor
      Found in modules/Users/models/Privileges.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\Request' in method 'setSharedOwner'.
      Open

              if ('SaveAjax' == \App\Request::_get('action') && \App\Request::_has('field') && 'shownerid' != \App\Request::_get('field')) {
      Severity: Minor
      Found in modules/Users/models/Privileges.php by phpmd

      StaticAccess

      Since: 1.4.0

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

      Example

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

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

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

              return self::getInstanceById(App\User::getCurrentUserId());
      Severity: Minor
      Found in modules/Users/models/Privileges.php by phpmd

      StaticAccess

      Since: 1.4.0

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

      Example

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

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

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

                  \App\Cache::delete('SharedOwnerFieldValue', $record);
      Severity: Minor
      Found in modules/Users/models/Privileges.php by phpmd

      StaticAccess

      Since: 1.4.0

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

      Example

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

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

      Avoid using static access to class 'Vtiger_Record_Model' in method 'getParentRecord'.
      Open

                          $recordModel = Vtiger_Record_Model::getInstanceById($record);
      Severity: Minor
      Found in modules/Users/models/Privileges.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 'getName'.
      Open

                  $entityData = \App\Module::getEntityInfo('Users');
      Severity: Minor
      Found in modules/Users/models/Privileges.php by phpmd

      StaticAccess

      Since: 1.4.0

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

      Example

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

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

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

              } else {
                  self::$userPrivilegesModelCache = [];
              }
      Severity: Minor
      Found in modules/Users/models/Privileges.php by phpmd

      ElseExpression

      Since: 1.4.0

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

      Example

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

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

      Avoid using static access to class 'Vtiger_Module_Model' in method 'hasModulePermission'.
      Open

              $moduleModel = Vtiger_Module_Model::getInstance($mixed);
      Severity: Minor
      Found in modules/Users/models/Privileges.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\Purifier' in method 'getName'.
      Open

                  $this->label = \App\Purifier::encodeHtml(implode($separator, $labelName));
      Severity: Minor
      Found in modules/Users/models/Privileges.php by phpmd

      StaticAccess

      Since: 1.4.0

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

      Example

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

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

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

              $db = \App\Db::getInstance();
      Severity: Minor
      Found in modules/Users/models/Privileges.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 'getParentRecord'.
      Open

                  $recordMetaData = vtlib\Functions::getCRMRecordMetadata($record);
      Severity: Minor
      Found in modules/Users/models/Privileges.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\Record' in method 'getParentRecord'.
      Open

                          if (!empty($value) && \App\Record::isExists($value)) {
      Severity: Minor
      Found in modules/Users/models/Privileges.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 '367', column '13').
      Open

          public static function getParentRecord($record, $moduleName = false, $type = 1, $actionid = false)
          {
              $cacheKey = "$record,$moduleName,$type,$actionid";
              if (\App\Cache::staticHas('PrivilegesParentRecord', $cacheKey)) {
                  return \App\Cache::staticGet('PrivilegesParentRecord', $cacheKey);
      Severity: Minor
      Found in modules/Users/models/Privileges.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\Privilege' in method 'isPermittedByUserId'.
      Open

              return \App\Privilege::isPermitted($moduleName, $actionName, $record, $userId);
      Severity: Minor
      Found in modules/Users/models/Privileges.php by phpmd

      StaticAccess

      Since: 1.4.0

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

      Example

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

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

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

              $userModel = App\User::getCurrentUserModel();
      Severity: Minor
      Found in modules/Users/models/Privileges.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\ModuleHierarchy' in method 'getParentRecord'.
      Open

              if ($parentModule = \App\ModuleHierarchy::getModulesMap1M($moduleName)) {
      Severity: Minor
      Found in modules/Users/models/Privileges.php by phpmd

      StaticAccess

      Since: 1.4.0

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

      Example

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

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

      Avoid using static access to class 'Vtiger_Module_Model' in method 'getParentRecord'.
      Open

                  $parentModuleModel = Vtiger_Module_Model::getInstance($moduleName);
      Severity: Minor
      Found in modules/Users/models/Privileges.php by phpmd

      StaticAccess

      Since: 1.4.0

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

      Example

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

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

      Avoid using static access to class 'Vtiger_Loader' in method 'checkLockEdit'.
      Open

              Vtiger_Loader::includeOnce('~~modules/com_vtiger_workflow/VTEntityMethodManager.php');
      Severity: Minor
      Found in modules/Users/models/Privileges.php by phpmd

      StaticAccess

      Since: 1.4.0

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

      Example

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

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

      Avoid using static access to class 'Vtiger_Module_Model' in method 'hasModuleActionPermission'.
      Open

              $moduleModel = Vtiger_Module_Model::getInstance($mixed);
      Severity: Minor
      Found in modules/Users/models/Privileges.php by phpmd

      StaticAccess

      Since: 1.4.0

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

      Example

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

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

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

              if (\App\Cache::staticHas('PrivilegesParentRecord', $cacheKey)) {
      Severity: Minor
      Found in modules/Users/models/Privileges.php by phpmd

      StaticAccess

      Since: 1.4.0

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

      Example

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

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

      Avoid using static access to class 'Vtiger_Loader' in method 'checkLockEdit'.
      Open

              Vtiger_Loader::includeOnce('~~modules/com_vtiger_workflow/include.php');
      Severity: Minor
      Found in modules/Users/models/Privileges.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\Request' in method 'setSharedOwner'.
      Open

              if ('SaveAjax' == \App\Request::_get('action') && \App\Request::_has('field') && 'shownerid' != \App\Request::_get('field')) {
      Severity: Minor
      Found in modules/Users/models/Privileges.php by phpmd

      StaticAccess

      Since: 1.4.0

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

      Example

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

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

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

                  return \App\Cache::staticGet('PrivilegesParentRecord', $cacheKey);
      Severity: Minor
      Found in modules/Users/models/Privileges.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 'getParentRecord'.
      Open

                      $recordMetaData = vtlib\Functions::getCRMRecordMetadata($id);
      Severity: Minor
      Found in modules/Users/models/Privileges.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 'getParentRecord'.
      Open

                                      $relatedPermission = \App\Privilege::isPermittedBySharing($recordMetaData['setype'], \App\Module::getModuleId($recordMetaData['setype']), $actionid, $id, $currentUserId);
      Severity: Minor
      Found in modules/Users/models/Privileges.php by phpmd

      StaticAccess

      Since: 1.4.0

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

      Example

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

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

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

              \App\Cache::staticSave('PrivilegesParentRecord', $cacheKey, $parentRecord);
      Severity: Minor
      Found in modules/Users/models/Privileges.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 'getParentRecord'.
      Open

                                      $relatedPermission = \App\Privilege::isPermittedBySharing($recordMetaData['setype'], \App\Module::getModuleId($recordMetaData['setype']), $actionid, $id, $currentUserId);
      Severity: Minor
      Found in modules/Users/models/Privileges.php by phpmd

      StaticAccess

      Since: 1.4.0

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

      Example

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

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

      Avoid using static access to class '\App\Fields\SharedOwner' in method 'getParentRecord'.
      Open

                                      $relatedPermission = \in_array($currentUserId, \App\Fields\SharedOwner::getById($id));
      Severity: Minor
      Found in modules/Users/models/Privileges.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 'getParentRecord'.
      Open

                                      $relatedPermission = \App\Privilege::isPermittedBySharing($recordMetaData['setype'], \App\Module::getModuleId($recordMetaData['setype']), $actionid, $id, $currentUserId);
      Severity: Minor
      Found in modules/Users/models/Privileges.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 'getParentRecord'.
      Open

                                      $relatedPermission = \App\Privilege::isPermittedBySharing($recordMetaData['setype'], \App\Module::getModuleId($recordMetaData['setype']), $actionid, $id, $currentUserId);
      Severity: Minor
      Found in modules/Users/models/Privileges.php by phpmd

      StaticAccess

      Since: 1.4.0

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

      Example

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

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

      Avoid using static access to class '\App\Fields\SharedOwner' in method 'getParentRecord'.
      Open

                                      $relatedPermission = \in_array($currentUserId, \App\Fields\SharedOwner::getById($id));
      Severity: Minor
      Found in modules/Users/models/Privileges.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 'getParentRecord'.
      Open

                      $recordMetaData = vtlib\Functions::getCRMRecordMetadata($id);
      Severity: Minor
      Found in modules/Users/models/Privileges.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 'getParentRecord'.
      Open

                                      $relatedPermission = \App\Privilege::isPermitted($recordMetaData['setype'], 'DetailView', $id);
      Severity: Minor
      Found in modules/Users/models/Privileges.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 'getParentRecord'.
      Open

                                      $relatedPermission = \App\Privilege::isPermitted($recordMetaData['setype'], 'DetailView', $id);
      Severity: Minor
      Found in modules/Users/models/Privileges.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\ModuleHierarchy' in method 'getParentRecord'.
      Open

              } elseif ($relationInfo = \App\ModuleHierarchy::getModulesMapMMCustom($moduleName)) {
      Severity: Minor
      Found in modules/Users/models/Privileges.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\Log' in method 'getProfiles'.
      Open

              \App\Log::trace('Get profile list');
      Severity: Minor
      Found in modules/Users/models/Privileges.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 "setype" 9 times.
      Open

                  $moduleName = $recordMetaData['setype'];
      Severity: Critical
      Found in modules/Users/models/Privileges.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 "relcrmid" 3 times.
      Open

                  $dataReader = (new \App\Db\Query())->select(['relcrmid', 'crmid'])
      Severity: Critical
      Found in modules/Users/models/Privileges.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 "PrivilegesParentRecord" 3 times.
      Open

              if (\App\Cache::staticHas('PrivilegesParentRecord', $cacheKey)) {
      Severity: Critical
      Found in modules/Users/models/Privileges.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 "smownerid" 4 times.
      Open

                                      $relatedPermission = $recordMetaData['smownerid'] == $currentUserId || \in_array($recordMetaData['smownerid'], $currentUserGroups);
      Severity: Critical
      Found in modules/Users/models/Privileges.php by sonar-php

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

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

      Noncompliant Code Example

      With the default threshold of 3:

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

      Compliant Solution

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

      Exceptions

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

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

                  $db->createCommand()->delete('u_#__crmentity_showners', ['crmid' => $record])->execute();
      Severity: Critical
      Found in modules/Users/models/Privileges.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 "permissionsrelatedfield" 4 times.
      Open

                      $permissionsRoleForRelatedField = $role->get('permissionsrelatedfield');
      Severity: Critical
      Found in modules/Users/models/Privileges.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.

      Avoid unused parameters such as '$module'.
      Open

          public static function getInstanceById($userId, $module = null)
      Severity: Minor
      Found in modules/Users/models/Privileges.php by phpmd

      UnusedFormalParameter

      Since: 0.2

      Avoid passing parameters to methods or constructors and then not using those parameters.

      Example

      class Foo
      {
          private function bar($howdy)
          {
              // $howdy is not used
          }
      }

      Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

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

              $userModel = App\User::getCurrentUserModel();
      Severity: Critical
      Found in modules/Users/models/Privileges.php by phan

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

                  $dataReader = (new \App\Db\Query())->select(['relcrmid', 'crmid'])
      Severity: Critical
      Found in modules/Users/models/Privileges.php by phan

      Suspicious type false of a variable or expression used to build a string. (Expected type to be able to cast to a string)
      Open

              $cacheKey = "$record,$moduleName,$type,$actionid";
      Severity: Minor
      Found in modules/Users/models/Privileges.php by phan

      Saw unextractable annotation for comment '* @return <number> 0/1'</number>
      Open

           * @return <Number> 0/1
      Severity: Info
      Found in modules/Users/models/Privileges.php by phan

      Saw unextractable annotation for comment '* @param <number> $tabId'</number>
      Open

           * @param <Number>        $tabId
      Severity: Info
      Found in modules/Users/models/Privileges.php by phan

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

                  $db->createCommand()->delete('u_#__crmentity_showners', ['crmid' => $record])->execute();
      Severity: Critical
      Found in modules/Users/models/Privileges.php by phan

      Parameter $actionid has undeclared type \type
      Open

          public static function getParentRecord($record, $moduleName = false, $type = 1, $actionid = false)
      Severity: Minor
      Found in modules/Users/models/Privileges.php by phan

      Argument 1 (value) is string but \Vtiger_Action_Model::getInstance() takes int defined at /code/modules/Vtiger/models/Action.php:126
      Open

                  $action = Vtiger_Action_Model::getInstance($action);
      Severity: Minor
      Found in modules/Users/models/Privileges.php by phan

      Saw unextractable annotation for comment '* @return <number> 0/1'</number>
      Open

           * @return <Number> 0/1
      Severity: Info
      Found in modules/Users/models/Privileges.php by phan

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

              $valueMap = App\User::getPrivilegesFile($userId);
      Severity: Critical
      Found in modules/Users/models/Privileges.php by phan

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

              return self::getInstanceById(App\User::getCurrentUserId());
      Severity: Critical
      Found in modules/Users/models/Privileges.php by phan

      Argument 2 (key) is int but \App\Cache::delete() takes string defined at /code/app/Cache.php:105
      Open

                  \App\Cache::delete('SharedOwnerFieldValue', $record);
      Severity: Minor
      Found in modules/Users/models/Privileges.php by phan

      Suspicious type \type|false of a variable or expression used to build a string. (Expected type to be able to cast to a string)
      Open

              $cacheKey = "$record,$moduleName,$type,$actionid";
      Severity: Minor
      Found in modules/Users/models/Privileges.php by phan

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

                  $dataReader = (new \App\Db\Query())->select(['crmid' => $relationInfo['rel']])->from($relationInfo['table'])
      Severity: Critical
      Found in modules/Users/models/Privileges.php by phan

      Saw unextractable annotation for comment '* @param <number> $userId'</number>
      Open

           * @param <Number>   $userId
      Severity: Info
      Found in modules/Users/models/Privileges.php by phan

      Declaration of function getProfiles() : array should be compatible with function getProfiles() : string defined in /code/modules/Users/models/Record.php:531
      Open

          public function getProfiles()
      Severity: Minor
      Found in modules/Users/models/Privileges.php by phan

      Saw unextractable annotation for comment '* @param <string> $action'</string>
      Open

           * @param <String/Number> $action
      Severity: Info
      Found in modules/Users/models/Privileges.php by phan

      Argument 2 (executionCondition) is int but \VTWorkflowManager::getWorkflowsForModule() takes false|string defined at /code/modules/com_vtiger_workflow/VTWorkflowManager.php:180
      Open

              $workflows = (new VTWorkflowManager())->getWorkflowsForModule($moduleName, VTWorkflowManager::$BLOCK_EDIT);
      Severity: Minor
      Found in modules/Users/models/Privileges.php by phan

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

                      $db->createCommand()->insert('u_#__crmentity_showners', [
      Severity: Critical
      Found in modules/Users/models/Privileges.php by phan

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

              \App\Log::trace('Get profile list');
      Severity: Critical
      Found in modules/Users/models/Privileges.php by phan

      Argument 2 (haystack) is false but \in_array() takes array
      Open

              } elseif (\in_array($moduleName, \App\ModuleHierarchy::getModulesMapMMBase())) {
      Severity: Minor
      Found in modules/Users/models/Privileges.php by phan

      Saw unextractable annotation for comment '* @param <array> $valueMap'</array>
      Open

           * @param <Array> $valueMap
      Severity: Info
      Found in modules/Users/models/Privileges.php by phan

      Default value for \type $actionid can't be false
      Open

          public static function getParentRecord($record, $moduleName = false, $type = 1, $actionid = false)
      Severity: Minor
      Found in modules/Users/models/Privileges.php by phan

      Returning type null but getInstanceById() is declared to return \Users_Privileges_Model
      Open

                  return null;
      Severity: Minor
      Found in modules/Users/models/Privileges.php by phan

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

                      foreach ($permissionsRelatedField as $row) {
                          if (!$relatedPermission) {
                              switch ($row) {
                                  case 0:
                                      $relatedPermission = $recordMetaData['smownerid'] == $currentUserId || \in_array($recordMetaData['smownerid'], $currentUserGroups);
      Severity: Major
      Found in modules/Users/models/Privileges.php and 1 other location - About 4 hrs to fix
      modules/Users/models/Privileges.php on lines 335..354

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 162.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

                      foreach ($permissionsRelatedField as $row) {
                          if (!$relatedPermission) {
                              switch ($row) {
                                  case 0:
                                      $relatedPermission = $recordMetaData['smownerid'] == $currentUserId || \in_array($recordMetaData['smownerid'], $currentUserGroups);
      Severity: Major
      Found in modules/Users/models/Privileges.php and 1 other location - About 4 hrs to fix
      modules/Users/models/Privileges.php on lines 376..395

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 162.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

              $profileGlobalPermissions = $this->get('profile_global_permission');
      Severity: Minor
      Found in modules/Users/models/Privileges.php by phpmd

      LongVariable

      Since: 0.2

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

      Example

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

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

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

          protected static $userPrivilegesModelCache = [];
      Severity: Minor
      Found in modules/Users/models/Privileges.php by phpmd

      LongVariable

      Since: 0.2

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

      Example

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

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

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

              $profileTabsPermissions = $this->get('profile_tabs_permission');
      Severity: Minor
      Found in modules/Users/models/Privileges.php by phpmd

      LongVariable

      Since: 0.2

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

      Example

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

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

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

              $profileGlobalPermissions = $this->get('profile_global_permission');
      Severity: Minor
      Found in modules/Users/models/Privileges.php by phpmd

      LongVariable

      Since: 0.2

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

      Example

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

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

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

              $profileTabsPermissions = $this->get('profile_action_permission');
      Severity: Minor
      Found in modules/Users/models/Privileges.php by phpmd

      LongVariable

      Since: 0.2

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

      Example

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

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

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

                      $permissionsRoleForRelatedField = $role->get('permissionsrelatedfield');
      Severity: Minor
      Found in modules/Users/models/Privileges.php by phpmd

      LongVariable

      Since: 0.2

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

      Example

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

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

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

                      $permissionsRelatedField = '' == $permissionsRoleForRelatedField ? [] : explode(',', $role->get('permissionsrelatedfield'));
      Severity: Minor
      Found in modules/Users/models/Privileges.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

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

      class Users_Privileges_Model extends Users_Record_Model

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

              $db = \App\Db::getInstance();
      Severity: Minor
      Found in modules/Users/models/Privileges.php by phpmd

      ShortVariable

      Since: 0.2

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

      Example

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

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

      The class Users_Privileges_Model is not named in CamelCase.
      Open

      class Users_Privileges_Model extends Users_Record_Model
      {
          /**
           * Function to get the Display Name for the record.
           *
      Severity: Minor
      Found in modules/Users/models/Privileges.php by phpmd

      CamelCaseClassName

      Since: 0.2

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

      Example

      class class_name {
      }

      Source

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

                      $id = $row['crmid'] == $record ? $row['relcrmid'] : $row['crmid'];
      Severity: Minor
      Found in modules/Users/models/Privileges.php by phpmd

      ShortVariable

      Since: 0.2

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

      Example

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

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

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

                  $separator = $entityData['separator'] ?? ' ';

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

                  foreach ($entityData['fieldnameArr'] as $columnName) {

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

          {

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

              if (!isset($this->label)) {

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

           * @return string - Entity Display Name for the record

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

          public function getName(): string

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

                  $entityData = \App\Module::getEntityInfo('Users');

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

           * Function to get the Display Name for the record.

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

           */

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

                  $labelName = [];

      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

           *

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

           */

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

           * Function to check if the user has Global Write Permission.

      Line exceeds 120 characters; contains 128 characters
      Open

              return $this->isAdminUser() || Settings_Profiles_Module_Model::IS_PERMITTED_VALUE === $this->getGlobalWritePermission();

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

          public function hasGlobalPermission($actionId)

      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 hasModulePermission($mixed)

      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

              if (isset(self::$userPrivilegesModelCache[$userId])) {

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

           * Static function to get the User Privileges Model for the 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

           * Function to get the Global Write Permission for the user.

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

              $profileGlobalPermissions = $this->get('profile_global_permission');

      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 hasGlobalWritePermission()

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

              return !empty($moduleModel) && $moduleModel->isActive() && ($this->isAdminUser() || (isset($profileTabsPermissions[$moduleModel->getId()]) && 0 === $profileTabsPermissions[$moduleModel->getId()]));

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

              $actionId = $action->getId();

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

                      $fieldModel = $this->getModule()->getFieldByColumn($columnName);

      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

           * Function to check if the user has Global Read Permission.

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

          public function hasGlobalReadPermission()

      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

           * @param <String/Number> $action

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

           * @param mixed           $mixed

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

                  $valueMap = array_merge($valueMap, $valueMap['user_info']);

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

              $instance = self::getInstance($valueMap);

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

          public static function checkLockEdit($moduleName, Vtiger_Record_Model $recordModel)

      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

           * @return bool true/false

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

              return $this->isAdminUser() || Settings_Profiles_Module_Model::IS_PERMITTED_VALUE === $this->getGlobalWritePermission();

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

                  return $this->hasGlobalWritePermission();

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

           * @return bool true/false

      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

              foreach ($valueMap as $key => $value) {

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

                  return null;

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

              self::$userPrivilegesModelCache[$userId] = $instance;

      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

           * Function to check whether the user has access to a given module by tabid.

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

              $profileTabsPermissions = $this->get('profile_tabs_permission');

      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

                  $action = Vtiger_Action_Model::getInstance($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

              $instance->setData($valueMap);

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

          /**

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

          protected static $lockEditCache = [];

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

                  return $this->hasGlobalReadPermission();

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

           * Function to check whether the user has access to the specified action/operation on a given module by tabid.

      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

                  return self::$userPrivilegesModelCache[$userId];

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

          public static function getCurrentUserPrivilegesModel()

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

           * Function to get the Global Read Permission for the 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

           * @return <Number> 0/1

      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

              $profileTabsPermissions = $this->get('profile_action_permission');

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

                  $mixed = 1;

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

           * Static Function to get the instance of the User Privileges model from the given list of key-value 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

              if (empty($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

              return $profileGlobalPermissions[Settings_Profiles_Module_Model::GLOBAL_ACTION_VIEW];

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

              return $this->isAdminUser()

      Line exceeds 120 characters; contains 205 characters
      Open

              return !empty($moduleModel) && $moduleModel->isActive() && ($this->isAdminUser() || (isset($profileTabsPermissions[$moduleModel->getId()]) && 0 === $profileTabsPermissions[$moduleModel->getId()]));

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

           * @param <Array> $valueMap

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

              $valueMap = App\User::getPrivilegesFile($userId);

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

              return $instance;

      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 int $mixed

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

              $moduleModel = Vtiger_Module_Model::getInstance($mixed);

      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

           * @param mixed|null $module

      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 self::getInstanceById(App\User::getCurrentUserId());

      Line exceeds 120 characters; contains 125 characters
      Open

                      $labelName[] = $fieldModel->getDisplayValue($this->get($fieldModel->getName()), $this->getId(), $this, true);

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

              if (Settings_Profiles_Module_Model::GLOBAL_ACTION_VIEW == $actionId) {

      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 \Users_Privileges_Model object

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

              $instance = new self();

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

              $instance->setModule('Users');

      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 <Number> 0/1

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

              $profileGlobalPermissions = $this->get('profile_global_permission');

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

              return false;

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

           * @return bool true/false

      Line exceeds 120 characters; contains 292 characters
      Open

              return $moduleModel->isActive() && $this->hasModulePermission($mixed) && (($this->isAdminUser() || (isset($profileTabsPermissions[$moduleModel->getId()][$actionId]) && Settings_Profiles_Module_Model::IS_PERMITTED_VALUE === $profileTabsPermissions[$moduleModel->getId()][$actionId])));

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

           * Static Function to get the instance of the User Privileges model, given the 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

              }

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

           * @return bool true/false

      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 hasModuleActionPermission($mixed, $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

                  $instance->{$key} = $value;

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

           */

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

                  || Settings_Profiles_Module_Model::IS_PERMITTED_VALUE === $this->getGlobalWritePermission();

      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 <Number>        $tabId

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

              if ((is_numeric($mixed) && 3 === $mixed) || 'Home' === $mixed) {

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

           * @return \Users_Privileges_Model object

      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

           *

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

              return $profileGlobalPermissions[Settings_Profiles_Module_Model::GLOBAL_ACTION_EDIT];

      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

              if (!is_a($action, 'Vtiger_Action_Model')) {

      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 <Number>   $userId

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

          public static function getInstanceById($userId, $module = null)

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

              $instance->setId($userId);

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

           * @return \Users_Privileges_Model object

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

                      $labelName[] = $fieldModel->getDisplayValue($this->get($fieldModel->getName()), $this->getId(), $this, true);

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

           */

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

          protected function getGlobalWritePermission()

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

          }

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

              if (Settings_Profiles_Module_Model::GLOBAL_ACTION_EDIT == $actionId) {

      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

              $moduleModel = Vtiger_Module_Model::getInstance($mixed);

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

              return $moduleModel->isActive() && $this->hasModulePermission($mixed) && (($this->isAdminUser() || (isset($profileTabsPermissions[$moduleModel->getId()][$actionId]) && Settings_Profiles_Module_Model::IS_PERMITTED_VALUE === $profileTabsPermissions[$moduleModel->getId()][$actionId])));

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

          public static function getInstance($valueMap)

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

          protected static $userPrivilegesModelCache = [];

      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

                  $this->label = \App\Purifier::encodeHtml(implode($separator, $labelName));

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

              return $this->label;

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

          protected function getGlobalReadPermission()

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

          {

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

                  || Settings_Profiles_Module_Model::IS_PERMITTED_VALUE === $this->getGlobalReadPermission()

      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

              return $instance;

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

              if (\is_array($valueMap['user_info'])) {

      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 int|bool $userId

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

              if ($saveFull) {

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

                  $parentModelFields = $parentModuleModel->getFields();

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

                          $value = $recordModel->get($fieldName);

      Line exceeds 120 characters; contains 163 characters
      Open

                                      $relatedPermission = $recordMetaData['smownerid'] == $currentUserId || \in_array($recordMetaData['smownerid'], $currentUserGroups);

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

          {

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

              if (empty($recordId)) {

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

           * Clear LockEdit Cache.

      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

          public static function setSharedOwner($userIds, $record)

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

                  if (empty($userIds)) {

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

                  }

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

                          'userid' => $userId,

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

                      ])->execute();

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

          public static function getParentRecord($record, $moduleName = false, $type = 1, $actionid = false)

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

                      $rparentRecord = self::getParentRecord($parentRecord, false, $type, $actionid);

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

                  while ($row = $dataReader->read()) {

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

                  return self::$lockEditCache[$moduleName . $recordId];

      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

              if ($userId) {

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

           * @param string|bool $moduleName

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

           * @return int|bool

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

                  $role = $userModel->getRoleInstance();

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

                      ->from('vtiger_crmentityrel')

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

                              switch ($row) {

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

          public static function clearLockEditCache(string $cacheName = '')

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

              self::$lockEditCache = [];

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

           * @param int              $record

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

              }

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

                  if (!\is_array($userIds) && $userIds) {

      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

          /**

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

              $saveFull = true;

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

                  $saveFull = false;

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

                      $userIds = explode(',', $userIds);

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

                      $db->createCommand()->insert('u_#__crmentity_showners', [

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

              if (!$moduleName) {

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

                      $relatedPermission = false;

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

                          if (!$relatedPermission) {

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

                  return $return;

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

          {

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

                  $db->createCommand()->delete('u_#__crmentity_showners', ['crmid' => $record])->execute();

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

           * @param type        $actionid

      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::getCurrentUserModel();

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

              $parentRecord = false;

      Line exceeds 120 characters; contains 140 characters
      Open

                      $permissionsRelatedField = '' == $permissionsRoleForRelatedField ? [] : explode(',', $role->get('permissionsrelatedfield'));

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

              self::$lockEditCache[$moduleName . $recordId] = $return;

      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 int|array|string $userIds

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

              if ('SaveAjax' == \App\Request::_get('action') && \App\Request::_has('field') && 'shownerid' != \App\Request::_get('field')) {

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

          /**

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

                  if ($parentRecord && 2 == $type) {

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

                      $recordMetaData = vtlib\Functions::getCRMRecordMetadata($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

              $cacheKey = "$record,$moduleName,$type,$actionid";

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

              $currentUserId = $userModel->getId();

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

              if ($parentModule = \App\ModuleHierarchy::getModulesMap1M($moduleName)) {

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

                          if (!empty($value) && \App\Record::isExists($value)) {

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

              } elseif (\in_array($moduleName, \App\ModuleHierarchy::getModulesMapMMBase())) {

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

                  $dataReader = (new \App\Db\Query())->select(['relcrmid', 'crmid'])

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

                                  case 0:

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

              if (isset(self::$lockEditCache[$moduleName . $recordId])) {

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

                      if ($workflow->evaluate($recordModel)) {

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

              return $return;

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

                          'crmid' => $record,

      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 ($parentModelFields as $fieldName => $fieldModel) {

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

                  }

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

                      ->createCommand()->query();

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

                      $permissionsRoleForRelatedField = $role->get('permissionsrelatedfield');

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

              Vtiger_Loader::includeOnce('~~modules/com_vtiger_workflow/include.php');

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

                  self::$lockEditCache = [];

      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

                  self::$userPrivilegesModelCache = [];

      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 false;

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

                  \App\Cache::delete('SharedOwnerFieldValue', $record);

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

          public static function isPermittedByUserId($userId, $moduleName, $actionName = '', $record = false)

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

           *

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

                  $moduleName = $recordMetaData['setype'];

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

              $return = false;

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

                  self::$lockEditCache[$moduleName . $recordId] = $return;

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

           * @param string $cacheName

      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

                  foreach (array_unique($userIds) as $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

                  $recordMetaData = vtlib\Functions::getCRMRecordMetadata($record);

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

                          $recordModel = Vtiger_Record_Model::getInstanceById($record);

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

              }

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

              if (\count($workflows)) {

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

                  foreach ($workflows as &$workflow) {

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

          public static function clearCache($userId = false)

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

                  unset(self::$userPrivilegesModelCache[$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

              $currentUserGroups = (array) $userModel->get('groups');

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

                  $parentModuleModel = Vtiger_Module_Model::getInstance($moduleName);

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

                  }

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

                      ->where(['or', ['crmid' => $record], ['relcrmid' => $record]])

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

                                      $relatedPermission = $recordMetaData['smownerid'] == $currentUserId || \in_array($recordMetaData['smownerid'], $currentUserGroups);

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

              Vtiger_Loader::includeOnce('~~modules/com_vtiger_workflow/VTEntityMethodManager.php');

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

              $workflows = (new VTWorkflowManager())->getWorkflowsForModule($moduleName, VTWorkflowManager::$BLOCK_EDIT);

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

              if ($cacheName && isset(self::$lockEditCache[$cacheName])) {

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

           */

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

           * Function to set Shared Owner.

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

              return \App\Privilege::isPermitted($moduleName, $actionName, $record, $userId);

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

           * @param int         $record

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

              if (\App\Cache::staticHas('PrivilegesParentRecord', $cacheKey)) {

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

                  return \App\Cache::staticGet('PrivilegesParentRecord', $cacheKey);

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

                      if ($fieldModel->isReferenceField() && \count(array_intersect($parentModule, $fieldModel->getReferenceList())) > 0) {

      Line exceeds 120 characters; contains 133 characters
      Open

                      if ($fieldModel->isReferenceField() && \count(array_intersect($parentModule, $fieldModel->getReferenceList())) > 0) {

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

                      if ($rparentRecord) {

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

                  $parentRecord = $record != $parentRecord ? $parentRecord : false;

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

                      foreach ($permissionsRelatedField as $row) {

      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

                          $return = true;

      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

           * @param int         $type

      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 1:

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

              $recordId = $recordModel->getId();

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

                  }

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

                  unset(self::$lockEditCache[$cacheName]);

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

              } elseif (!$cacheName) {

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

           * Clear user cache.

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

              $db = \App\Db::getInstance();

      Line exceeds 120 characters; contains 134 characters
      Open

              if ('SaveAjax' == \App\Request::_get('action') && \App\Request::_has('field') && 'shownerid' != \App\Request::_get('field')) {

      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 parent record 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

                              $parentRecord = $value;

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

                          $parentRecord = $rparentRecord;

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

                      }

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

                      $id = $row['crmid'] == $record ? $row['relcrmid'] : $row['crmid'];

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

                      $permissionsRelatedField = '' == $permissionsRoleForRelatedField ? [] : explode(',', $role->get('permissionsrelatedfield'));

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

                      $relatedPermission = false;

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

                      foreach ($permissionsRelatedField as $row) {

      Line exceeds 120 characters; contains 163 characters
      Open

                                      $relatedPermission = $recordMetaData['smownerid'] == $currentUserId || \in_array($recordMetaData['smownerid'], $currentUserGroups);

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

                                  case 3:

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

              return $parentRecord;

      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

                          $parentRecord = $id;

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

                          $rparentRecord = self::getParentRecord($id, $recordMetaData['setype'], $type, $actionid);

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

                      }

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

                  $dataReader = (new \App\Db\Query())->select(['crmid' => $relationInfo['rel']])->from($relationInfo['table'])

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

                  while ($id = $dataReader->readColumn(0)) {

      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

                  $role = $userModel->getRoleInstance();

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

                                      $relatedPermission = \App\Privilege::isPermittedBySharing($recordMetaData['setype'], \App\Module::getModuleId($recordMetaData['setype']), $actionid, $id, $currentUserId);

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

                      if (2 == $type) {

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

                          if ($rparentRecord) {

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

                      if (2 == $type) {

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

                      if ($relatedPermission) {

      Line exceeds 120 characters; contains 202 characters
      Open

                                      $relatedPermission = \App\Privilege::isPermittedBySharing($recordMetaData['setype'], \App\Module::getModuleId($recordMetaData['setype']), $actionid, $id, $currentUserId);

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

                      if ($relatedPermission) {

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

                              $parentRecord = $rparentRecord;

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

                      }

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

              \App\Cache::staticSave('PrivilegesParentRecord', $cacheKey, $parentRecord);

      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

                  }

      Line exceeds 120 characters; contains 202 characters
      Open

                                      $relatedPermission = \App\Privilege::isPermittedBySharing($recordMetaData['setype'], \App\Module::getModuleId($recordMetaData['setype']), $actionid, $id, $currentUserId);

      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

                          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

                                  case 2:

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

                      }

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

                          $parentRecord = $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

                      $permissionsRelatedField = '' == $role->get('permissionsrelatedfield') ? [] : explode(',', $role->get('permissionsrelatedfield'));

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

                              switch ($row) {

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

                                  case 0:

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

                                  case 1:

      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

                                      $relatedPermission = \App\Privilege::isPermitted($recordMetaData['setype'], 'DetailView', $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

              }

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

                                      $relatedPermission = $recordMetaData['smownerid'] == $currentUserId || \in_array($recordMetaData['smownerid'], $currentUserGroups);

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

          }

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

                                      $relatedPermission = \App\Privilege::isPermittedBySharing($recordMetaData['setype'], \App\Module::getModuleId($recordMetaData['setype']), $actionid, $id, $currentUserId);

      Line exceeds 120 characters; contains 127 characters
      Open

                                      $relatedPermission = \App\Privilege::isPermitted($recordMetaData['setype'], 'DetailView', $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

              return $this->get('profiles');

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

                                      $relatedPermission = \in_array($currentUserId, \App\Fields\SharedOwner::getById($id));

      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

                                  case 3:

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

                                      $relatedPermission = \in_array($currentUserId, \App\Fields\SharedOwner::getById($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

                                      break;

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

                  $dataReader->close();

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

              } elseif ($relationInfo = \App\ModuleHierarchy::getModulesMapMMCustom($moduleName)) {

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

                      ->createCommand()->query();

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

                          if (!$relatedPermission) {

      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

                          $rparentRecord = self::getParentRecord($id, $recordMetaData['setype'], $type, $actionid);

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

                  $dataReader->close();

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

          public function getProfiles()

      Line exceeds 120 characters; contains 127 characters
      Open

                                      $relatedPermission = \App\Privilege::isPermitted($recordMetaData['setype'], 'DetailView', $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

                          }

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

              \App\Log::trace('Get profile list');

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

                                      $relatedPermission = \App\Privilege::isPermitted($recordMetaData['setype'], 'DetailView', $id);

      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

                      $recordMetaData = vtlib\Functions::getCRMRecordMetadata($id);

      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

                                  default:

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

                              }

      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;

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

                          if ($rparentRecord) {

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

                      ->where([$relationInfo['base'] => $record])

      Line exceeds 120 characters; contains 146 characters
      Open

                      $permissionsRelatedField = '' == $role->get('permissionsrelatedfield') ? [] : explode(',', $role->get('permissionsrelatedfield'));

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

                                  case 2:

      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

                              $parentRecord = $rparentRecord;

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

           * Get profiles ids.

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

      class Users_Privileges_Model extends Users_Record_Model

      There are no issues that match your filters.

      Category
      Status