Function checkPermission
has a Cognitive Complexity of 131 (exceeds 5 allowed). Consider refactoring. Open
public static function checkPermission($moduleName, $actionName = null, $record = false, $userId = false)
{
\App\Log::trace("Entering isPermitted($moduleName,$actionName,$record,$userId) method ...");
if (!$userId) {
$userId = \App\User::getCurrentUserId();
- Read upRead up
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 isReadPermittedBySharing
has a Cognitive Complexity of 69 (exceeds 5 allowed). Consider refactoring. Open
public static function isReadPermittedBySharing($moduleName, $tabId, $actionId, $recordId, $userId)
{
\App\Log::trace("Entering isReadPermittedBySharing($moduleName,$tabId,$actionId,$recordId,$userId) method ...");
$sharingPrivileges = \App\User::getSharingFile($userId);
- Read upRead up
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 isReadWritePermittedBySharing
has a Cognitive Complexity of 69 (exceeds 5 allowed). Consider refactoring. Open
public static function isReadWritePermittedBySharing($moduleName, $tabId, $actionId, $recordId, $userId)
{
\App\Log::trace("Entering isReadWritePermittedBySharing($moduleName,$tabId,$actionId,$recordId,$userId) method ...");
$sharingPrivileges = \App\User::getSharingFile($userId);
if (!isset($sharingPrivileges['permission'][$moduleName])) {
- Read upRead up
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 checkPermission
has 259 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function checkPermission($moduleName, $actionName = null, $record = false, $userId = false)
{
\App\Log::trace("Entering isPermitted($moduleName,$actionName,$record,$userId) method ...");
if (!$userId) {
$userId = \App\User::getCurrentUserId();
File Privilege.php
has 459 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace App;
/**
The class Privilege has an overall complexity of 162 which is very high. The configured complexity threshold is 50. Open
class Privilege
{
public static $isPermittedLevel;
/**
- Exclude checks
Method isReadPermittedBySharing
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function isReadPermittedBySharing($moduleName, $tabId, $actionId, $recordId, $userId)
{
\App\Log::trace("Entering isReadPermittedBySharing($moduleName,$tabId,$actionId,$recordId,$userId) method ...");
$sharingPrivileges = \App\User::getSharingFile($userId);
Method isReadWritePermittedBySharing
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function isReadWritePermittedBySharing($moduleName, $tabId, $actionId, $recordId, $userId)
{
\App\Log::trace("Entering isReadWritePermittedBySharing($moduleName,$tabId,$actionId,$recordId,$userId) method ...");
$sharingPrivileges = \App\User::getSharingFile($userId);
if (!isset($sharingPrivileges['permission'][$moduleName])) {
Function isPermittedBySharing
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public static function isPermittedBySharing($moduleName, $tabId, $actionId, $recordId, $userId)
{
$sharingPrivileges = \App\User::getSharingFile($userId);
//Retreiving the default Organisation sharing Access
$othersPermissionId = $sharingPrivileges['defOrgShare'][$tabId];
- Read upRead up
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
Avoid deeply nested control flow statements. Open
if (\App\Config::security('PERMITTED_BY_SHARING')) {
$relatedPermission = static::isPermittedBySharing($recordMetaData['setype'], Module::getModuleId($recordMetaData['setype']), $actionId, $parentRecord, $userId);
}
Consider simplifying this complex logical expression. Open
if (((3 == $actionId || 4 == $actionId) && 0 != $role->get('previewrelatedrecord')) || ((0 == $actionId || 1 == $actionId) && 0 != $role->get('editrelatedrecord'))) {
$parentRecord = \Users_Privileges_Model::getParentRecord($record, $moduleName, $role->get('previewrelatedrecord'), $actionId);
if ($parentRecord && Record::isExists($parentRecord)) {
$recordMetaData = \vtlib\Functions::getCRMRecordMetadata($parentRecord);
$permissionsRoleForRelatedField = $role->get('permissionsrelatedfield');
Method isPermittedBySharing
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public static function isPermittedBySharing($moduleName, $tabId, $actionId, $recordId, $userId)
Method isReadPermittedBySharing
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public static function isReadPermittedBySharing($moduleName, $tabId, $actionId, $recordId, $userId)
Method isReadWritePermittedBySharing
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public static function isReadWritePermittedBySharing($moduleName, $tabId, $actionId, $recordId, $userId)
Avoid too many return
statements within this method. Open
return false;
Avoid too many return
statements within this method. Open
return true;
Avoid too many return
statements within this method. Open
return true;
Avoid too many return
statements within this method. Open
return true;
Avoid too many return
statements within this method. Open
return 2 !== $actionId;
Avoid too many return
statements within this method. Open
return false;
Avoid too many return
statements within this method. Open
return false;
Avoid too many return
statements within this method. Open
return false;
Avoid too many return
statements within this method. Open
return $isPermittedPrivateRecord;
Avoid too many return
statements within this method. Open
return $permission;
Avoid too many return
statements within this method. Open
return false;
Avoid too many return
statements within this method. Open
return false;
Avoid too many return
statements within this method. Open
return true;
Avoid too many return
statements within this method. Open
return false;
Avoid too many return
statements within this method. Open
return true;
Avoid too many return
statements within this method. Open
return true;
Avoid too many return
statements within this method. Open
return true;
Avoid too many return
statements within this method. Open
return false;
Avoid too many return
statements within this method. Open
return true;
Avoid too many return
statements within this method. Open
return true;
Avoid too many return
statements within this method. Open
return true;
Avoid too many return
statements within this method. Open
return $permission;
Avoid too many return
statements within this method. Open
return true;
Avoid too many return
statements within this method. Open
return true;
Avoid too many return
statements within this method. Open
return false;
Avoid too many return
statements within this method. Open
return true;
Avoid too many return
statements within this method. Open
return true;
Avoid too many return
statements within this method. Open
return false;
Avoid too many return
statements within this method. Open
return true;
Avoid too many return
statements within this method. Open
return true;
Avoid too many return
statements within this method. Open
return static::isReadWritePermittedBySharing($moduleName, $tabId, $actionId, $recordId, $userId);
Avoid too many return
statements within this method. Open
return true;
Avoid too many return
statements within this method. Open
return true;
Avoid too many return
statements within this method. Open
return true;
Avoid too many return
statements within this method. Open
return true;
Avoid too many return
statements within this method. Open
return static::isReadPermittedBySharing($moduleName, $tabId, $actionId, $recordId, $userId);
Avoid too many return
statements within this method. Open
return true;
The method isReadPermittedBySharing() has an NPath complexity of 1144. The configured NPath complexity threshold is 200. Open
public static function isReadPermittedBySharing($moduleName, $tabId, $actionId, $recordId, $userId)
{
\App\Log::trace("Entering isReadPermittedBySharing($moduleName,$tabId,$actionId,$recordId,$userId) method ...");
$sharingPrivileges = \App\User::getSharingFile($userId);
- Read upRead up
- Exclude checks
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 checkPermission() has 277 lines of code. Current threshold is set to 100. Avoid really long methods. Open
public static function checkPermission($moduleName, $actionName = null, $record = false, $userId = false)
{
\App\Log::trace("Entering isPermitted($moduleName,$actionName,$record,$userId) method ...");
if (!$userId) {
$userId = \App\User::getCurrentUserId();
- Exclude checks
The method checkPermission() has an NPath complexity of 12695305125888000. The configured NPath complexity threshold is 200. Open
public static function checkPermission($moduleName, $actionName = null, $record = false, $userId = false)
{
\App\Log::trace("Entering isPermitted($moduleName,$actionName,$record,$userId) method ...");
if (!$userId) {
$userId = \App\User::getCurrentUserId();
- Read upRead up
- Exclude checks
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 isReadWritePermittedBySharing() has an NPath complexity of 648. The configured NPath complexity threshold is 200. Open
public static function isReadWritePermittedBySharing($moduleName, $tabId, $actionId, $recordId, $userId)
{
\App\Log::trace("Entering isReadWritePermittedBySharing($moduleName,$tabId,$actionId,$recordId,$userId) method ...");
$sharingPrivileges = \App\User::getSharingFile($userId);
if (!isset($sharingPrivileges['permission'][$moduleName])) {
- Read upRead up
- Exclude checks
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 isPermittedBySharing() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10. Open
public static function isPermittedBySharing($moduleName, $tabId, $actionId, $recordId, $userId)
{
$sharingPrivileges = \App\User::getSharingFile($userId);
//Retreiving the default Organisation sharing Access
$othersPermissionId = $sharingPrivileges['defOrgShare'][$tabId];
- Read upRead up
- Exclude checks
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
The method checkPermission() has a Cyclomatic Complexity of 104. The configured cyclomatic complexity threshold is 10. Open
public static function checkPermission($moduleName, $actionName = null, $record = false, $userId = false)
{
\App\Log::trace("Entering isPermitted($moduleName,$actionName,$record,$userId) method ...");
if (!$userId) {
$userId = \App\User::getCurrentUserId();
- Read upRead up
- Exclude checks
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
The method isReadPermittedBySharing() has a Cyclomatic Complexity of 20. The configured cyclomatic complexity threshold is 10. Open
public static function isReadPermittedBySharing($moduleName, $tabId, $actionId, $recordId, $userId)
{
\App\Log::trace("Entering isReadPermittedBySharing($moduleName,$tabId,$actionId,$recordId,$userId) method ...");
$sharingPrivileges = \App\User::getSharingFile($userId);
- Read upRead up
- Exclude checks
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
The method isReadWritePermittedBySharing() has a Cyclomatic Complexity of 21. The configured cyclomatic complexity threshold is 10. Open
public static function isReadWritePermittedBySharing($moduleName, $tabId, $actionId, $recordId, $userId)
{
\App\Log::trace("Entering isReadWritePermittedBySharing($moduleName,$tabId,$actionId,$recordId,$userId) method ...");
$sharingPrivileges = \App\User::getSharingFile($userId);
if (!isset($sharingPrivileges['permission'][$moduleName])) {
- Read upRead up
- Exclude checks
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 150 to the 15 allowed. Open
public static function checkPermission($moduleName, $actionName = null, $record = false, $userId = false)
- Read upRead up
- Exclude checks
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
This function "checkPermission" has 276 lines, which is greater than the 150 lines authorized. Split it into smaller functions. Open
public static function checkPermission($moduleName, $actionName = null, $record = false, $userId = false)
- Read upRead up
- Exclude checks
A function that grows too large tends to aggregate too many responsibilities.
Such functions inevitably become harder to understand and therefore harder to maintain.
Above a specific threshold, it is strongly advised to refactor into smaller functions which focus on well-defined tasks.
Those smaller functions will not only be easier to understand, but also probably easier to test.
Reduce the number of returns of this function 8, down to the maximum allowed 3. Open
public static function isReadPermittedBySharing($moduleName, $tabId, $actionId, $recordId, $userId)
- Read upRead up
- Exclude checks
Having too many return statements in a function increases the function's essential complexity because the flow of execution is broken each time a return statement is encountered. This makes it harder to read and understand the logic of the function.
Noncompliant Code Example
With the default threshold of 3:
function myFunction(){ // Noncompliant as there are 4 return statements if (condition1) { return true; } else { if (condition2) { return false; } else { return true; } } return false; }
Refactor this function to reduce its Cognitive Complexity from 69 to the 15 allowed. Open
public static function isReadWritePermittedBySharing($moduleName, $tabId, $actionId, $recordId, $userId)
- Read upRead up
- Exclude checks
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
Reduce the number of returns of this function 8, down to the maximum allowed 3. Open
public static function isReadWritePermittedBySharing($moduleName, $tabId, $actionId, $recordId, $userId)
- Read upRead up
- Exclude checks
Having too many return statements in a function increases the function's essential complexity because the flow of execution is broken each time a return statement is encountered. This makes it harder to read and understand the logic of the function.
Noncompliant Code Example
With the default threshold of 3:
function myFunction(){ // Noncompliant as there are 4 return statements if (condition1) { return true; } else { if (condition2) { return false; } else { return true; } } return false; }
Refactor this function to reduce its Cognitive Complexity from 69 to the 15 allowed. Open
public static function isReadPermittedBySharing($moduleName, $tabId, $actionId, $recordId, $userId)
- Read upRead up
- Exclude checks
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
Reduce the number of returns of this function 8, down to the maximum allowed 3. Open
public static function isPermittedBySharing($moduleName, $tabId, $actionId, $recordId, $userId)
- Read upRead up
- Exclude checks
Having too many return statements in a function increases the function's essential complexity because the flow of execution is broken each time a return statement is encountered. This makes it harder to read and understand the logic of the function.
Noncompliant Code Example
With the default threshold of 3:
function myFunction(){ // Noncompliant as there are 4 return statements if (condition1) { return true; } else { if (condition2) { return false; } else { return true; } } return false; }
Reduce the number of returns of this function 29, down to the maximum allowed 3. Open
public static function checkPermission($moduleName, $actionName = null, $record = false, $userId = false)
- Read upRead up
- Exclude checks
Having too many return statements in a function increases the function's essential complexity because the flow of execution is broken each time a return statement is encountered. This makes it harder to read and understand the logic of the function.
Noncompliant Code Example
With the default threshold of 3:
function myFunction(){ // Noncompliant as there are 4 return statements if (condition1) { return true; } else { if (condition2) { return false; } else { return true; } } return false; }
The class Privilege has a coupling between objects value of 14. Consider to reduce the number of dependencies under 13. Open
class Privilege
{
public static $isPermittedLevel;
/**
- Read upRead up
- Exclude checks
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 checkPermission has a boolean flag argument $record, which is a certain sign of a Single Responsibility Principle violation. Open
public static function checkPermission($moduleName, $actionName = null, $record = false, $userId = false)
- Read upRead up
- Exclude checks
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 isPermitted has a boolean flag argument $record, which is a certain sign of a Single Responsibility Principle violation. Open
public static function isPermitted($moduleName, $actionName = null, $record = false, $userId = false)
- Read upRead up
- Exclude checks
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 isPermitted has a boolean flag argument $userId, which is a certain sign of a Single Responsibility Principle violation. Open
public static function isPermitted($moduleName, $actionName = null, $record = false, $userId = false)
- Read upRead up
- Exclude checks
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 checkPermission has a boolean flag argument $userId, which is a certain sign of a Single Responsibility Principle violation. Open
public static function checkPermission($moduleName, $actionName = null, $record = false, $userId = false)
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
The method setUpdater has a boolean flag argument $priority, which is a certain sign of a Single Responsibility Principle violation. Open
public static function setUpdater($moduleName, $record = false, $priority = false, $type = 1)
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
The method setUpdater has a boolean flag argument $record, which is a certain sign of a Single Responsibility Principle violation. Open
public static function setUpdater($moduleName, $record = false, $priority = false, $type = 1)
- Read upRead up
- Exclude checks
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 checkPermission uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$permission = false;
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class '\App\Log' in method 'checkPermission'. Open
\App\Log::trace('Exiting isPermitted method ... - SEC_MODULE_NO_ACTION_TOOL');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Config' in method 'checkPermission'. Open
if (\App\Config::security('PERMITTED_BY_SHARED_OWNERS')) {
- Read upRead up
- Exclude checks
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 'checkPermission'. Open
$recordMetaData = \vtlib\Functions::getCRMRecordMetadata($parentRecord);
- Read upRead up
- Exclude checks
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 'checkPermission'. Open
$userPrivileges = \App\User::getPrivilegesFile($userId);
- Read upRead up
- Exclude checks
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 'checkPermission'. Open
\App\Log::trace('Exiting isPermitted method ... - SEC_RECORD_DELETED');
- Read upRead up
- Exclude checks
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 'checkPermission'. Open
\App\Log::trace('Exiting isPermitted method ... - ' . static::$isPermittedLevel);
- Read upRead up
- Exclude checks
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 'isReadPermittedBySharing'. Open
\App\Log::trace("Entering isReadPermittedBySharing($moduleName,$tabId,$actionId,$recordId,$userId) method ...");
- Read upRead up
- Exclude checks
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 'checkPermission'. Open
\App\Log::trace("Entering isPermitted($moduleName,$actionName,$record,$userId) method ...");
- Read upRead up
- Exclude checks
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 'checkPermission'. Open
\App\Log::trace('Exiting isPermitted method ... - SEC_MODULE_EDIT_ALL_PERMISSION');
- Read upRead up
- Exclude checks
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 'checkPermission'. Open
$shownerids = Fields\SharedOwner::getById($record);
- Read upRead up
- Exclude checks
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 'checkPermission'. Open
$relatedPermission = \in_array($userId, Fields\SharedOwner::getById($parentRecord));
- Read upRead up
- Exclude checks
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 'checkPermission'. Open
\App\Log::trace('Exiting isPermitted method ... - yes');
- Read upRead up
- Exclude checks
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 'checkPermission'. Open
\App\Log::trace('Exiting isPermitted method ... - SEC_RECORD_ARCHIVED');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'App\Fields\Owner' in method 'checkPermission'. Open
$recOwnType = Fields\Owner::getType($recOwnId);
- Read upRead up
- Exclude checks
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 '208', column '8'). Open
public static function checkPermission($moduleName, $actionName = null, $record = false, $userId = false)
{
\App\Log::trace("Entering isPermitted($moduleName,$actionName,$record,$userId) method ...");
if (!$userId) {
$userId = \App\User::getCurrentUserId();
- Read upRead up
- Exclude checks
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\Log' in method 'checkPermission'. Open
\App\Log::trace('Exiting isPermitted method ... - ' . ($permission) ? 'YES' : 'NO');
- Read upRead up
- Exclude checks
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 'checkPermission'. Open
\App\Log::trace('Exiting isPermitted method ... - ' . static::$isPermittedLevel);
- Read upRead up
- Exclude checks
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 'checkPermission'. Open
\App\Log::trace('Exiting isPermitted method ... - SEC_MODULE_IS_OWNEDBY');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\Users_Privileges_Model' in method 'checkPermission'. Open
$userPrivilegesModel = \Users_Privileges_Model::getInstanceById($userId);
- Read upRead up
- Exclude checks
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 'checkPermission'. Open
\App\Log::trace('Exiting isPermitted method ... - SEC_RECORD_HIERARCHY_USER');
- Read upRead up
- Exclude checks
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 'checkPermission'. Open
$actionId = Module::getActionId($actionName);
- Read upRead up
- Exclude checks
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 'checkPermission'. Open
\App\Log::trace('Exiting isPermitted method ... - SEC_MODULE_VIEW_ALL_PERMISSION');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Field' in method 'checkPermission'. Open
&& ($fieldInfo = \App\Field::getFieldInfo('private', $recordMetaData['setype'])) && \in_array($fieldInfo['presence'], [0, 2])) {
- Read upRead up
- Exclude checks
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 'checkPermission'. Open
\App\Log::trace('Exiting isPermitted method ... - SEC_RECORD_SHARED_OWNER');
- Read upRead up
- Exclude checks
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 'checkPermission'. Open
\App\Log::trace('Exiting isPermitted method ... - SEC_RECORD_OWNER_SUBORDINATE_USER');
- Read upRead up
- Exclude checks
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 'isReadPermittedBySharing'. Open
\App\Log::trace('Exiting isReadPermittedBySharing method ...');
- Read upRead up
- Exclude checks
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 'checkPermission'. Open
\App\Log::trace('Exiting isPermitted method ... - SEC_MODULE_NO_RIGHTS_TO_ACTION');
- Read upRead up
- Exclude checks
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 'checkPermission'. Open
\App\Log::trace('Exiting isPermitted method ... - SEC_RECORD_ARCHIVED');
- Read upRead up
- Exclude checks
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 'isReadPermittedBySharing'. Open
$recordMetaData = \vtlib\Functions::getCRMRecordMetadata($recordId);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Fields\Owner' in method 'isReadPermittedBySharing'. Open
$ownerType = \App\Fields\Owner::getType($ownerId);
- Read upRead up
- Exclude checks
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 '249', column '8'). Open
public static function checkPermission($moduleName, $actionName = null, $record = false, $userId = false)
{
\App\Log::trace("Entering isPermitted($moduleName,$actionName,$record,$userId) method ...");
if (!$userId) {
$userId = \App\User::getCurrentUserId();
- Read upRead up
- Exclude checks
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\Log' in method 'checkPermission'. Open
\App\Log::trace('Exiting isPermitted method ... - SEC_RECORD_DELETED');
- Read upRead up
- Exclude checks
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 'checkPermission'. Open
\App\Log::trace('Exiting isPermitted method ... - SEC_ADVANCED_PERMISSION_NO');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Config' in method 'checkPermission'. Open
if (($modules = \App\Config::security('permittedModulesByCreatorField')) && \in_array($moduleName, $modules) && $userId === $recordMetaData['smcreatorid']) {
- Read upRead up
- Exclude checks
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 'checkPermission'. Open
\App\Log::trace('Exiting isPermitted method ... - SEC_ACTION_DOES_NOT_EXIST');
- Read upRead up
- Exclude checks
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 'checkPermission'. Open
\App\Log::trace('Exiting isPermitted method ... - SEC_RECORD_OWNER_CURRENT_GROUP');
- Read upRead up
- Exclude checks
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 'checkPermission'. Open
if (1 === Module::getModuleOwner($tabId)) {
- Read upRead up
- Exclude checks
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 'checkPermission'. Open
\App\Log::trace('Exiting isPermitted method ... - SEC_RECORD_DOES_NOT_EXIST');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Config' in method 'checkPermission'. Open
if (\App\Config::security('PERMITTED_BY_ROLES')) {
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Config' in method 'checkPermission'. Open
if (\App\Config::security('PERMITTED_BY_SHARING')) {
- Read upRead up
- Exclude checks
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 'checkPermission'. Open
$userId = \App\User::getCurrentUserId();
- Read upRead up
- Exclude checks
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 'checkPermission'. Open
\App\Log::trace('Exiting isPermitted method ... - SEC_USER_IS_ADMIN');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Config' in method 'checkPermission'. Open
if (!$isPermittedPrivateRecord && \App\Config::security('PERMITTED_BY_SHARED_OWNERS')) {
- Read upRead up
- Exclude checks
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 'checkPermission'. Open
$shownerIds = Fields\SharedOwner::getById($record);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Config' in method 'checkPermission'. Open
if (\App\Config::security('PERMITTED_BY_ADVANCED_PERMISSION')) {
- Read upRead up
- Exclude checks
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 'isPermittedBySharing'. Open
$sharingPrivileges = \App\User::getSharingFile($userId);
- Read upRead up
- Exclude checks
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 'checkPermission'. Open
if (!Module::isModuleActive($moduleName)) {
- Read upRead up
- Exclude checks
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 'checkPermission'. Open
\App\Log::trace('Exiting isPermitted method ... - SEC_RECORD_CREATOR_CURRENT_USER_WRITE_ACCESS');
- Read upRead up
- Exclude checks
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 'checkPermission'. Open
$relatedPermission = static::isPermittedBySharing($recordMetaData['setype'], Module::getModuleId($recordMetaData['setype']), $actionId, $parentRecord, $userId);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Config' in method 'checkPermission'. Open
if (\App\Config::security('PERMITTED_BY_SHARING')) {
- Read upRead up
- Exclude checks
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 'isReadPermittedBySharing'. Open
$sharingPrivileges = \App\User::getSharingFile($userId);
- Read upRead up
- Exclude checks
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 'checkPermission'. Open
\App\Log::trace('Exiting isPermitted method ... - SEC_MODULE_PERMISSIONS_NO');
- Read upRead up
- Exclude checks
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 'checkPermission'. Open
\App\Log::trace('Exiting isPermitted method ... - SEC_MODULE_RIGHTS_TO_ACTION');
- Read upRead up
- Exclude checks
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 'checkPermission'. Open
\App\Log::trace('Exiting isPermitted method ... - ' . static::$isPermittedLevel);
- Read upRead up
- Exclude checks
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 'checkPermission'. Open
$recordMetaData = \vtlib\Functions::getCRMRecordMetadata($record);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Fields\Owner' in method 'checkPermission'. Open
$recOwnType = \App\Fields\Owner::getType($recOwnId);
- Read upRead up
- Exclude checks
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\PrivilegeAdvanced' in method 'checkPermission'. Open
$prvAdv = PrivilegeAdvanced::checkPermissions($record, $moduleName, $userId);
- Read upRead up
- Exclude checks
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 'checkPermission'. Open
\App\Log::trace('Exiting isPermitted method ... - SEC_ADVANCED_PERMISSION_YES');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\Users_Privileges_Model' in method 'checkPermission'. Open
$parentRecord = \Users_Privileges_Model::getParentRecord($record, $moduleName, $role->get('previewrelatedrecord'), $actionId);
- Read upRead up
- Exclude checks
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 'checkPermission'. Open
$tabId = Module::getModuleId($moduleName);
- Read upRead up
- Exclude checks
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 'checkPermission'. Open
if ('Settings' !== Request::_get('parent')) {
- Read upRead up
- Exclude checks
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 'checkPermission'. Open
\App\Log::trace('Exiting isPermitted method ... - SEC_RECORD_DOES_NOT_EXIST');
- Read upRead up
- Exclude checks
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 'checkPermission'. Open
\App\Log::trace('Exiting isPermitted method ... - SEC_RECORD_ID_IS_NULL');
- Read upRead up
- Exclude checks
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 'checkPermission'. Open
$recordMetaData = \vtlib\Functions::getCRMRecordMetadata($record);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Config' in method 'checkPermission'. Open
if (\App\Config::security('PERMITTED_BY_PRIVATE_FIELD') && $recordMetaData['private']
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Config' in method 'checkPermission'. Open
if (\App\Config::security('permittedWriteAccessByCreatorField') && (0 == $actionId || 1 == $actionId)) {
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Config' in method 'checkPermission'. Open
if (\App\Config::security('PERMITTED_BY_RECORD_HIERARCHY')) {
- Read upRead up
- Exclude checks
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 'checkPermission'. Open
if ($parentRecord && Record::isExists($parentRecord)) {
- Read upRead up
- Exclude checks
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 isReadPermittedBySharing uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
if (isset($read['GROUP'][$ownerId])) {
\App\Log::trace('Exiting isReadPermittedBySharing method ...');
return true;
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class '\App\User' in method 'checkPermission'. Open
if ('Users' === $moduleName && $record == \App\User::getCurrentUserId()) {
- Read upRead up
- Exclude checks
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 'checkPermission'. Open
\App\Log::trace('Exiting isPermitted method ... - yes');
- Read upRead up
- Exclude checks
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 'checkPermission'. Open
\App\Log::trace('Exiting isPermitted method ... - SEC_RECORD_CREATOR_CURRENT_USER_READ_ACCESS');
- Read upRead up
- Exclude checks
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 'checkPermission'. Open
\App\Log::trace('Exiting isPermitted method ... - SEC_RECORD_OWNER_CURRENT_USER');
- Read upRead up
- Exclude checks
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 'isReadPermittedBySharing'. Open
\App\Log::trace('Exiting isReadPermittedBySharing method ...');
- Read upRead up
- Exclude checks
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 'isReadPermittedBySharing'. Open
\App\Log::trace('Exiting isReadPermittedBySharing method ...');
- Read upRead up
- Exclude checks
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 'isReadPermittedBySharing'. Open
\App\Log::trace('Exiting isReadPermittedBySharing method ...');
- Read upRead up
- Exclude checks
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 'isReadWritePermittedBySharing'. Open
\App\Log::trace('Exiting isReadWritePermittedBySharing method ...');
- Read upRead up
- Exclude checks
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 'isReadWritePermittedBySharing'. Open
\App\Log::trace('Exiting isReadWritePermittedBySharing method ...');
- Read upRead up
- Exclude checks
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 isReadWritePermittedBySharing uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
if (isset($writeRelated['GROUP'][$relOwnerId])) {
\App\Log::trace('Exiting isReadWritePermittedBySharing method ...');
return true;
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class '\App\Log' in method 'isReadWritePermittedBySharing'. Open
\App\Log::trace('Exiting isReadWritePermittedBySharing method ...');
- Read upRead up
- Exclude checks
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\PrivilegeUtil' in method 'isReadPermittedBySharing'. Open
$parRecordOwner = PrivilegeUtil::getParentRecordOwner($tabId, $parModId, $recordId);
- Read upRead up
- Exclude checks
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 'isReadPermittedBySharing'. Open
\App\Log::trace('Exiting isReadPermittedBySharing method ...');
- Read upRead up
- Exclude checks
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 'isReadWritePermittedBySharing'. Open
$sharingPrivileges = \App\User::getSharingFile($userId);
- Read upRead up
- Exclude checks
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 'isReadWritePermittedBySharing'. Open
\App\Log::trace('Exiting isReadWritePermittedBySharing method ...');
- Read upRead up
- Exclude checks
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\PrivilegeUpdater' in method 'setAllUpdater'. Open
PrivilegeUpdater::setAllUpdater();
- Read upRead up
- Exclude checks
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 'isReadWritePermittedBySharing'. Open
\App\Log::trace("Entering isReadWritePermittedBySharing($moduleName,$tabId,$actionId,$recordId,$userId) method ...");
- Read upRead up
- Exclude checks
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 'isReadWritePermittedBySharing'. Open
$recordMetaData = \vtlib\Functions::getCRMRecordMetadata($recordId);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Fields\Owner' in method 'isReadWritePermittedBySharing'. Open
$ownerType = \App\Fields\Owner::getType($ownerId);
- Read upRead up
- Exclude checks
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 'isReadWritePermittedBySharing'. Open
$parModName = Module::getModuleName($parModId);
- Read upRead up
- Exclude checks
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 isReadPermittedBySharing uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
if (isset($readRelated['GROUP'][$relOwnerId])) {
\App\Log::trace('Exiting isReadPermittedBySharing method ...');
return true;
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class 'App\PrivilegeUtil' in method 'isReadWritePermittedBySharing'. Open
$parRecordOwner = PrivilegeUtil::getParentRecordOwner($tabId, $parModId, $recordId);
- Read upRead up
- Exclude checks
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 'isReadPermittedBySharing'. Open
\App\Log::trace('Exiting isReadPermittedBySharing method ...');
- Read upRead up
- Exclude checks
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 'isReadPermittedBySharing'. Open
\App\Log::trace('Exiting isReadPermittedBySharing method ...');
- Read upRead up
- Exclude checks
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 'isReadWritePermittedBySharing'. Open
\App\Log::trace('Exiting isReadWritePermittedBySharing method ...');
- Read upRead up
- Exclude checks
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 'isReadWritePermittedBySharing'. Open
\App\Log::trace('Exiting isReadWritePermittedBySharing method ...');
- Read upRead up
- Exclude checks
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 'isReadWritePermittedBySharing'. Open
\App\Log::trace('Exiting isReadWritePermittedBySharing method ...');
- Read upRead up
- Exclude checks
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 'isReadPermittedBySharing'. Open
$parModName = Module::getModuleName($parModId);
- Read upRead up
- Exclude checks
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\PrivilegeUpdater' in method 'setUpdater'. Open
PrivilegeUpdater::setUpdater($moduleName, $record, $priority, $type);
- Read upRead up
- Exclude checks
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 "Groups" 3 times. Open
} elseif ('Groups' === $recOwnType) {
- Read upRead up
- Exclude checks
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 "GROUP" 8 times. Open
foreach ($read['GROUP'] as $userids) {
- Read upRead up
- Exclude checks
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 "profile_tabs_permission" 4 times. Open
if (isset($userPrivileges['profile_tabs_permission'][$tabId]) && 0 == $userPrivileges['profile_tabs_permission'][$tabId]) {
- Read upRead up
- Exclude checks
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 "Users" 8 times. Open
if ('Users' === $moduleName && $record == \App\User::getCurrentUserId()) {
- Read upRead up
- Exclude checks
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 "Exiting isReadPermittedBySharing method ..." 7 times. Open
\App\Log::trace('Exiting isReadPermittedBySharing method ...');
- Read upRead up
- Exclude checks
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 "Exiting isPermitted method ... - " 4 times. Open
\App\Log::trace('Exiting isPermitted method ... - ' . ($permission) ? 'YES' : 'NO');
- Read upRead up
- Exclude checks
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 "groups" 5 times. Open
if (\in_array($recOwnId, $userPrivileges['groups'])) {
- Read upRead up
- Exclude checks
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 "relatedModuleShare" 5 times. Open
if (isset($sharingPrivileges['relatedModuleShare'][$tabId])) {
- Read upRead up
- Exclude checks
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 "setype" 4 times. Open
&& ($fieldInfo = \App\Field::getFieldInfo('private', $recordMetaData['setype'])) && \in_array($fieldInfo['presence'], [0, 2])) {
- Read upRead up
- Exclude checks
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 "permission" 8 times. Open
if (!isset($sharingPrivileges['permission'][$moduleName])) {
- Read upRead up
- Exclude checks
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 "profile_global_permission" 3 times. Open
if ((0 == $userPrivileges['profile_global_permission'][1] || 0 == $userPrivileges['profile_global_permission'][2]) && (3 == $actionId || 4 == $actionId)) {
- Read upRead up
- Exclude checks
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 "profile_action_permission" 5 times. Open
if (!isset($userPrivileges['profile_action_permission'][$tabId][$actionId])) {
- Read upRead up
- Exclude checks
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" 6 times. Open
$recOwnId = $recordMetaData['smownerid'];
- Read upRead up
- Exclude checks
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 "Exiting isReadWritePermittedBySharing method ..." 7 times. Open
\App\Log::trace('Exiting isReadWritePermittedBySharing method ...');
- Read upRead up
- Exclude checks
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 "deleted" 4 times. Open
if (0 !== $recordMetaData['deleted'] && (1 === $actionId || 0 === $actionId || 17 === $actionId)) {
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Call to method getCurrentUserId
from undeclared class \App\User
(Did you mean class \Tests\App\User) Open
$userId = \App\User::getCurrentUserId();
- Exclude checks
Call to method getCurrentUserId
from undeclared class \App\User
(Did you mean class \Tests\App\User) Open
if ('Users' === $moduleName && $record == \App\User::getCurrentUserId()) {
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Exiting isPermitted method ... - yes');
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Exiting isPermitted method ... - SEC_ACTION_DOES_NOT_EXIST');
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Exiting isPermitted method ... - SEC_MODULE_NO_ACTION_TOOL');
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Exiting isPermitted method ... - SEC_MODULE_NO_RIGHTS_TO_ACTION');
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Exiting isReadPermittedBySharing method ...');
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Exiting isReadWritePermittedBySharing method ...');
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Exiting isReadWritePermittedBySharing method ...');
- Exclude checks
Default value for int
$record
can't be false
Open
public static function setUpdater($moduleName, $record = false, $priority = false, $type = 1)
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Exiting isPermitted method ... - SEC_RECORD_DOES_NOT_EXIST');
- Exclude checks
Expected @param annotation for tabId
to be before the @param annotation for actionId
Open
* @param $actionId -- Action Id:: Type integer
- Exclude checks
Default value for int
$priority
can't be false
Open
public static function setUpdater($moduleName, $record = false, $priority = false, $type = 1)
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Exiting isPermitted method ... - SEC_MODULE_RIGHTS_TO_ACTION');
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Exiting isPermitted method ... - SEC_RECORD_DOES_NOT_EXIST');
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Exiting isPermitted method ... - SEC_RECORD_CREATOR_CURRENT_USER_READ_ACCESS');
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Exiting isReadPermittedBySharing method ...');
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Exiting isPermitted method ... - ' . static::$isPermittedLevel);
- Exclude checks
Call to method getType
from undeclared class \App\Fields\Owner
Open
$recOwnType = \App\Fields\Owner::getType($recOwnId);
- Exclude checks
Argument 4 (actionid)
is 0|1|3|4
but \Users_Privileges_Model::getParentRecord()
takes \type|false
defined at /code/modules/Users/models/Privileges.php:289
Open
$parentRecord = \Users_Privileges_Model::getParentRecord($record, $moduleName, $role->get('previewrelatedrecord'), $actionId);
- Exclude checks
Call to method getSharingFile
from undeclared class \App\User
(Did you mean class \Tests\App\User) Open
$sharingPrivileges = \App\User::getSharingFile($userId);
- Exclude checks
Suspicious type false|true
of a variable or expression used to build a string. (Expected type to be able to cast to a string) Open
\App\Log::trace('Exiting isPermitted method ... - ' . ($permission) ? 'YES' : 'NO');
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Exiting isPermitted method ... - ' . ($permission) ? 'YES' : 'NO');
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Exiting isPermitted method ... - SEC_RECORD_ARCHIVED');
- Exclude checks
Call to method getType
from undeclared class \App\Fields\Owner
Open
$recOwnType = Fields\Owner::getType($recOwnId);
- Exclude checks
Expected @param annotation for tabId
to be before the @param annotation for actionId
Open
* @param $actionId -- Action Id:: Type integer
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace("Entering isReadWritePermittedBySharing($moduleName,$tabId,$actionId,$recordId,$userId) method ...");
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace("Entering isPermitted($moduleName,$actionName,$record,$userId) method ...");
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Exiting isPermitted method ... - SEC_MODULE_VIEW_ALL_PERMISSION');
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Exiting isPermitted method ... - ' . static::$isPermittedLevel);
- Exclude checks
Call to method getSharingFile
from undeclared class \App\User
(Did you mean class \Tests\App\User) Open
$sharingPrivileges = \App\User::getSharingFile($userId);
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Exiting isReadPermittedBySharing method ...');
- Exclude checks
Saw misspelled annotation @returns.
Did you mean @return?
Open
* @returns yes or no. If Yes means this action is allowed for the currently logged in user. If no means this action is not allowed for the currently logged in user
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Exiting isReadWritePermittedBySharing method ...');
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Exiting isPermitted method ... - SEC_MODULE_PERMISSIONS_NO');
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Exiting isPermitted method ... - SEC_ADVANCED_PERMISSION_YES');
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Exiting isPermitted method ... - SEC_RECORD_OWNER_CURRENT_GROUP');
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Exiting isPermitted method ... - ' . static::$isPermittedLevel);
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Exiting isReadPermittedBySharing method ...');
- Exclude checks
Call to method getType
from undeclared class \App\Fields\Owner
Open
$ownerType = \App\Fields\Owner::getType($ownerId);
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Exiting isPermitted method ... - SEC_MODULE_EDIT_ALL_PERMISSION');
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Exiting isPermitted method ... - SEC_ADVANCED_PERMISSION_NO');
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Exiting isReadWritePermittedBySharing method ...');
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Exiting isPermitted method ... - yes');
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Exiting isReadPermittedBySharing method ...');
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Exiting isPermitted method ... - SEC_RECORD_OWNER_CURRENT_USER');
- Exclude checks
Call to method getType
from undeclared class \App\Fields\Owner
Open
$ownerType = \App\Fields\Owner::getType($ownerId);
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Exiting isReadWritePermittedBySharing method ...');
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Exiting isPermitted method ... - SEC_RECORD_DELETED');
- Exclude checks
Saw misspelled annotation @returns.
Did you mean @return?
Open
* @returns yes or no. If Yes means this action is allowed for the currently logged in user. If no means this action is not allowed for the currently logged in user
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Exiting isPermitted method ... - SEC_RECORD_ID_IS_NULL');
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Exiting isPermitted method ... - SEC_RECORD_DELETED');
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Exiting isPermitted method ... - SEC_RECORD_CREATOR_CURRENT_USER_WRITE_ACCESS');
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Exiting isPermitted method ... - SEC_USER_IS_ADMIN');
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Exiting isPermitted method ... - SEC_RECORD_HIERARCHY_USER');
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Exiting isReadWritePermittedBySharing method ...');
- Exclude checks
Call to method getPrivilegesFile
from undeclared class \App\User
(Did you mean class \Tests\App\User) Open
$userPrivileges = \App\User::getPrivilegesFile($userId);
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Exiting isPermitted method ... - SEC_RECORD_SHARED_OWNER');
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Exiting isPermitted method ... - SEC_RECORD_OWNER_SUBORDINATE_USER');
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Exiting isReadPermittedBySharing method ...');
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Exiting isReadWritePermittedBySharing method ...');
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace("Entering isReadPermittedBySharing($moduleName,$tabId,$actionId,$recordId,$userId) method ...");
- Exclude checks
Saw an @param annotation for recordid,
but it was not found in the param list of function isReadWritePermittedBySharing($moduleName, $tabId, $actionId, mixed $recordId, mixed $userId)
Open
* @param $recordid -- Record Id:: Type integer
- Exclude checks
Call to method getSharingFile
from undeclared class \App\User
(Did you mean class \Tests\App\User) Open
$sharingPrivileges = \App\User::getSharingFile($userId);
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Exiting isPermitted method ... - SEC_MODULE_IS_OWNEDBY');
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Exiting isPermitted method ... - SEC_RECORD_ARCHIVED');
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Exiting isReadPermittedBySharing method ...');
- Exclude checks
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (!empty($parRecordOwner)) {
$parModName = Module::getModuleName($parModId);
if (isset($sharingPrivileges['permission'][$parModName . '_' . $moduleName])) {
$writeRelated = $sharingPrivileges['permission'][$parModName . '_' . $moduleName]['write'];
$relOwnerType = '';
- Read upRead up
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 226.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (\count($parRecordOwner) > 0) {
$parModName = Module::getModuleName($parModId);
if (isset($sharingPrivileges['permission'][$parModName . '_' . $moduleName])) {
$readRelated = $sharingPrivileges['permission'][$parModName . '_' . $moduleName]['read'];
- Read upRead up
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 226.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
if (0 !== $recordMetaData['deleted'] && (1 === $actionId || 0 === $actionId || 17 === $actionId)) {
switch ($recordMetaData['deleted']) {
case 1:
static::$isPermittedLevel = 'SEC_RECORD_DELETED';
\App\Log::trace('Exiting isPermitted method ... - SEC_RECORD_DELETED');
- Read upRead up
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 104.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
if (0 !== $recordMetaData['deleted'] && (1 === $actionId || 0 === $actionId || 17 === $actionId)) {
switch ($recordMetaData['deleted']) {
case 1:
static::$isPermittedLevel = 'SEC_RECORD_DELETED';
\App\Log::trace('Exiting isPermitted method ... - SEC_RECORD_DELETED');
- Read upRead up
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 104.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Avoid excessively long variable names like $permissionsRelatedField. Keep variable name length under 20. Open
$permissionsRelatedField = '' === $permissionsRoleForRelatedField ? [] : explode(',', $role->get('permissionsrelatedfield'));
- Read upRead up
- Exclude checks
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 $sharingPrivilegesModule. Keep variable name length under 20. Open
$sharingPrivilegesModule = $sharingPrivileges['permission'][$moduleName];
- Read upRead up
- Exclude checks
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 $isPermittedPrivateRecord. Keep variable name length under 20. Open
$isPermittedPrivateRecord = false;
- Read upRead up
- Exclude checks
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');
- Read upRead up
- Exclude checks
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 $sharingPrivilegesModule. Keep variable name length under 20. Open
$sharingPrivilegesModule = $sharingPrivileges['permission'][$moduleName];
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return (static::$interpreter)::isPermitted($moduleName, $actionName, $record, $userId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return static::checkPermission($moduleName, $actionName, $record, $userId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::$isPermittedLevel = 'SEC_IS_CURRENT_USER';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($userPrivileges['is_admin']) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function checkPermission($moduleName, $actionName = null, $record = false, $userId = false)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace("Entering isPermitted($moduleName,$actionName,$record,$userId) method ...");
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$permission = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$permission = $userPrivileges['is_admin'] ? true : false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::$isPermittedLevel = 'SEC_RECORD_DELETED';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
private static $interpreter;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userId = (int) $userId;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::$isPermittedLevel = 'SEC_ADMINISTRATION_MODULE_' . ($permission ? 'YES' : 'NO');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordMetaData = \vtlib\Functions::getCRMRecordMetadata($record);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::$isPermittedLevel = 'SEC_RECORD_ARCHIVED';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Interpreter for privilege.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!Module::isModuleActive($moduleName)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::$isPermittedLevel = 'SEC_RECORD_DOES_NOT_EXIST';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $userId
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty(static::$interpreter) && class_exists(static::$interpreter)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userPrivileges = \App\User::getPrivilegesFile($userId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('Exiting isPermitted method ... - yes');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('Exiting isPermitted method ... - ' . ($permission) ? 'YES' : 'NO');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('Exiting isPermitted method ... - yes');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $isPermittedLevel;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $moduleName
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$userId) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('Exiting isPermitted method ... - SEC_RECORD_DELETED');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::$isPermittedLevel = 'SEC_USER_IS_ADMIN';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
//If no actionid, then allow action is vtiger_tab permission is available
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($recordMetaData)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('Exiting isPermitted method ... - SEC_RECORD_ARCHIVED');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return bool
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tabId = Module::getModuleId($moduleName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('Exiting isPermitted method ... - SEC_USER_IS_ADMIN');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Sets interpreter.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param bool|int $record
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 2:
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return bool
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::$isPermittedLevel = 'SEC_MODULE_IS_INACTIVE';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 1:
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $className
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $actionName
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function isPermitted($moduleName, $actionName = null, $record = false, $userId = false)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $actionName
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $userId
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$actionId = Module::getActionId($actionName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (0 !== $recordMetaData['deleted'] && (1 === $actionId || 0 === $actionId || 17 === $actionId)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userId = \App\User::getCurrentUserId();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('Exiting isPermitted method ... - SEC_RECORD_DOES_NOT_EXIST');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
default:
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::$interpreter = $className;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to check permission for a Module/Action/Record.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $moduleName
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('Users' === $moduleName && $record == \App\User::getCurrentUserId()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($record && 'Users' !== $moduleName) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('Settings' !== Request::_get('parent')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $permission;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
switch ($recordMetaData['deleted']) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function setPermissionInterpreter(string $className)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Invokes function to check permission .
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param bool|int $record
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif (false === $tabId) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
//Checking whether the user is admin
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::$isPermittedLevel = 'SEC_MODULE_RIGHTS_TO_ACTION';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::$isPermittedLevel = 'SEC_RECORD_ARCHIVED';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
&& ($fieldInfo = \App\Field::getFieldInfo('private', $recordMetaData['setype'])) && \in_array($fieldInfo['presence'], [0, 2])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$prvAdv = PrivilegeAdvanced::checkPermissions($record, $moduleName, $userId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
//Checking for Action Permission
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!isset($userPrivileges['profile_action_permission'][$tabId][$actionId])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::$isPermittedLevel = 'SEC_MODULE_NO_ACTION_TOOL';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($record)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('Exiting isPermitted method ... - SEC_RECORD_CREATOR_CURRENT_USER_READ_ACCESS');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('Exiting isPermitted method ... - SEC_RECORD_CREATOR_CURRENT_USER_WRITE_ACCESS');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$permission = true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::$isPermittedLevel = 'SEC_MODULE_PERMISSIONS_NO';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (false === $actionId) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('Exiting isPermitted method ... - SEC_MODULE_NO_ACTION_TOOL');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (1 === Module::getModuleOwner($tabId)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($recordMetaData)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recOwnType = \App\Fields\Owner::getType($recOwnId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (false !== $prvAdv) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('' === $actionId || null === $actionId) {
- Exclude checks
Line exceeds 120 characters; contains 132 characters Open
if (!isset($userPrivileges['profile_tabs_permission'][$tabId]) || 0 != $userPrivileges['profile_tabs_permission'][$tabId]) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
default:
- Exclude checks
Line exceeds 120 characters; contains 165 characters Open
if (($modules = \App\Config::security('permittedModulesByCreatorField')) && \in_array($moduleName, $modules) && $userId === $recordMetaData['smcreatorid']) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::$isPermittedLevel = 'SEC_RECORD_CREATOR_CURRENT_USER_READ_ACCESS';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\in_array($userId, $shownerids) || \count(array_intersect($shownerids, $userPrivileges['groups'])) > 0) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($usersByRole[$recOwnId])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return true;
- Exclude checks
Line exceeds 120 characters; contains 142 characters Open
$parentRecord = \Users_Privileges_Model::getParentRecord($record, $moduleName, $role->get('previewrelatedrecord'), $actionId);
- Exclude checks
Line exceeds 120 characters; contains 145 characters Open
$permissionsRelatedField = '' === $permissionsRoleForRelatedField ? [] : explode(',', $role->get('permissionsrelatedfield'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 1:
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $permission;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$othersPermissionId = $sharingPrivileges['defOrgShare'][$tabId];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::$isPermittedLevel = 'SEC_NO_ACTION_MODULE_PERMISSIONS' . ($permission ? 'YES' : 'NO');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('Exiting isPermitted method ... - SEC_MODULE_RIGHTS_TO_ACTION');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
//Checking and returning true if recorid is null
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
switch ($recordMetaData['deleted']) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 2:
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\App\Config::security('PERMITTED_BY_PRIVATE_FIELD') && $recordMetaData['private']
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$level = 'SEC_PRIVATE_RECORD_NO';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::$isPermittedLevel = 'SEC_ADVANCED_PERMISSION_NO';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (3 == $actionId || 4 == $actionId) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recOwnId = $recordMetaData['smownerid'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('Users' === $recOwnType) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\App\Config::security('PERMITTED_BY_ROLES')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::$isPermittedLevel = 'SEC_RECORD_OWNER_SUBORDINATE_USER';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 2:
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\App\Config::security('PERMITTED_BY_SHARING')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$relatedPermission = static::isPermitted($recordMetaData['setype'], 'DetailView', $parentRecord);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
default:
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (1 == $othersPermissionId) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (3 === $actionId || 4 === $actionId) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return static::isReadPermittedBySharing($moduleName, $tabId, $actionId, $recordId, $userId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return 2 !== $actionId;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** Function to check if the currently logged in user has Read Access due to Sharing for the specified record.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('Exiting isReadPermittedBySharing method ...');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::$isPermittedLevel = 'SEC_MODULE_NO_RIGHTS_TO_ACTION';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::$isPermittedLevel = 'SEC_RECORD_ID_IS_NULL';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordMetaData = \vtlib\Functions::getCRMRecordMetadata($record);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::$isPermittedLevel = 'SEC_RECORD_DELETED';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('Exiting isPermitted method ... - SEC_RECORD_DELETED');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recOwnId = $recordMetaData['smownerid'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (((3 == $actionId || 4 == $actionId) && 0 != $role->get('previewrelatedrecord')) || ((0 == $actionId || 1 == $actionId) && 0 != $role->get('editrelatedrecord'))) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 3:
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('Exiting isPermitted method ... - SEC_MODULE_VIEW_ALL_PERMISSION');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (0 == $userPrivileges['profile_global_permission'][2] && (3 == $actionId || 4 == $actionId || 0 == $actionId || 1 == $actionId)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (3 == $othersPermissionId) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
//Checking the Read Sharing Permission Array in Role Users
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
switch ($row) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (2 == $othersPermissionId) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('Exiting isPermitted method ... - ' . static::$isPermittedLevel);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Line exceeds 120 characters; contains 163 characters Open
if ((0 == $userPrivileges['profile_global_permission'][1] || 0 == $userPrivileges['profile_global_permission'][2]) && (3 == $actionId || 4 == $actionId)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::$isPermittedLevel = 'SEC_RECORD_DOES_NOT_EXIST';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$isPermittedPrivateRecord = true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('Exiting isPermitted method ... - ' . static::$isPermittedLevel);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $isPermittedPrivateRecord;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (0 === $prvAdv) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('Exiting isPermitted method ... - SEC_ADVANCED_PERMISSION_YES');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$shownerids = Fields\SharedOwner::getById($record);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::$isPermittedLevel = 'SEC_RECORD_OWNER_CURRENT_GROUP';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$relatedPermission = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$permission = static::isPermittedBySharing($moduleName, $tabId, $actionId, $record, $userId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return 2 !== $actionId;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param $recordId -- Record Id:: Type integer
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($read['ROLE'] as $userids) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($read['GROUP'] as $userids) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('Exiting isPermitted method ... - SEC_ACTION_DOES_NOT_EXIST');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Line exceeds 120 characters; contains 156 characters Open
if (0 != $userPrivileges['profile_action_permission'][$tabId][$actionId] && '' != $userPrivileges['profile_action_permission'][$tabId][$actionId]) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 1:
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('Exiting isPermitted method ... - SEC_RECORD_ARCHIVED');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$level = 'SEC_PRIVATE_RECORD_OWNER_CURRENT_USER';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$isPermittedPrivateRecord && \App\Config::security('PERMITTED_BY_SHARED_OWNERS')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\App\Config::security('PERMITTED_BY_ADVANCED_PERMISSION')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\App\Config::security('permittedWriteAccessByCreatorField') && (0 == $actionId || 1 == $actionId)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
//Checking if the Record Owner is the current User
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('Exiting isPermitted method ... - SEC_RECORD_OWNER_CURRENT_USER');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('Exiting isPermitted method ... - SEC_RECORD_OWNER_SUBORDINATE_USER');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$relatedPermission = \in_array($userId, Fields\SharedOwner::getById($parentRecord));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($relatedPermission) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$sharingPrivileges = \App\User::getSharingFile($userId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$ownerType = \App\Fields\Owner::getType($ownerId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('Exiting isReadPermittedBySharing method ...');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$isPermittedPrivateRecord = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('Users' === $recOwnType) {
- Exclude checks
Line exceeds 120 characters; contains 125 characters Open
if (\in_array($userId, $shownerIds) || \count(array_intersect($shownerIds, $userPrivileges['groups'])) > 0) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Line exceeds 120 characters; contains 121 characters Open
if (\in_array($userId, $shownerids) || \count(array_intersect($shownerids, $userPrivileges['groups'])) > 0) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($userPrivileges['subordinate_roles_users'] as $usersByRole) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('Exiting isPermitted method ... - SEC_RECORD_OWNER_CURRENT_GROUP');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordMetaData = \vtlib\Functions::getCRMRecordMetadata($parentRecord);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('Exiting isPermitted method ... - ' . static::$isPermittedLevel);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
//Checking for Default Org Sharing permission
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param $moduleName -- Module Name:: Type varchar
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @returns yes or no. If Yes means this action is allowed for the currently logged in user. If no means this action is not allowed for the currently logged in user
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function isReadPermittedBySharing($moduleName, $tabId, $actionId, $recordId, $userId)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace("Entering isReadPermittedBySharing($moduleName,$tabId,$actionId,$recordId,$userId) method ...");
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$permissionsRelatedField = '' === $permissionsRoleForRelatedField ? [] : explode(',', $role->get('permissionsrelatedfield'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
//Retreiving the default Organisation sharing Access
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return static::isReadWritePermittedBySharing($moduleName, $tabId, $actionId, $recordId, $userId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (0 === $actionId || 1 === $actionId) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return static::isReadWritePermittedBySharing($moduleName, $tabId, $actionId, $recordId, $userId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$ownerId = $recordMetaData['smownerid'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
//If modules is Products,Vendors,Faq,PriceBook then no sharing
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($userId === $recOwnId) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// Check advanced permissions
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::$isPermittedLevel = 'SEC_RECORD_CREATOR_CURRENT_USER_WRITE_ACCESS';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::$isPermittedLevel = 'SEC_RECORD_SHARED_OWNER';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recOwnType = Fields\Owner::getType($recOwnId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif ('Groups' === $recOwnType) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\App\Config::security('PERMITTED_BY_SHARING')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$sharingPrivileges = \App\User::getSharingFile($userId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($userPrivileges['profile_tabs_permission'][$tabId]) && 0 == $userPrivileges['profile_tabs_permission'][$tabId]) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$permission = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('Exiting isPermitted method ... - SEC_MODULE_PERMISSIONS_NO');
- Exclude checks
Line exceeds 120 characters; contains 165 characters Open
if (\strlen($userPrivileges['profile_action_permission'][$tabId][$actionId]) < 1 && '' === $userPrivileges['profile_action_permission'][$tabId][$actionId]) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::$isPermittedLevel = 'SEC_MODULE_VIEW_ALL_PERMISSION';
- Exclude checks
Line exceeds 120 characters; contains 141 characters Open
if (0 == $userPrivileges['profile_global_permission'][2] && (3 == $actionId || 4 == $actionId || 0 == $actionId || 1 == $actionId)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('Exiting isPermitted method ... - SEC_RECORD_ID_IS_NULL');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Line exceeds 120 characters; contains 140 characters Open
&& ($fieldInfo = \App\Field::getFieldInfo('private', $recordMetaData['setype'])) && \in_array($fieldInfo['presence'], [0, 2])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif ('Groups' === $recOwnType) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$isPermittedPrivateRecord = true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\App\Config::security('PERMITTED_BY_SHARED_OWNERS')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$parentRecord = \Users_Privileges_Model::getParentRecord($record, $moduleName, $role->get('previewrelatedrecord'), $actionId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($parentRecord && Record::isExists($parentRecord)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$relatedPermission = $recordMetaData['smownerid'] === $userId || \in_array($recordMetaData['smownerid'], $userPrivileges['groups']);
- Exclude checks
Line exceeds 120 characters; contains 164 characters Open
$relatedPermission = $recordMetaData['smownerid'] === $userId || \in_array($recordMetaData['smownerid'], $userPrivileges['groups']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::$isPermittedLevel = 'SEC_RECORD_BY_SHARING_' . ($permission ? 'YES' : 'NO');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (0 == $othersPermissionId) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (1 === $actionId || 0 === $actionId) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return 2 !== $actionId;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\in_array($ownerId, $userids)) {
- Exclude checks
Line exceeds 120 characters; contains 135 characters Open
if (isset($userPrivileges['profile_tabs_permission'][$tabId]) && 0 == $userPrivileges['profile_tabs_permission'][$tabId]) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('Exiting isPermitted method ... - SEC_MODULE_NO_RIGHTS_TO_ACTION');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
//Checking for edit all permission
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::$isPermittedLevel = 'SEC_MODULE_EDIT_ALL_PERMISSION';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('Exiting isPermitted method ... - SEC_MODULE_EDIT_ALL_PERMISSION');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('Exiting isPermitted method ... - SEC_MODULE_IS_OWNEDBY');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (0 !== $recordMetaData['deleted'] && (1 === $actionId || 0 === $actionId || 17 === $actionId)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\in_array($userId, $shownerIds) || \count(array_intersect($shownerIds, $userPrivileges['groups'])) > 0) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
//Checking if the record owner is the current user's group
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\in_array($recOwnId, $userPrivileges['groups'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
//Retreiving the RecordOwnerId
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Line exceeds 120 characters; contains 168 characters Open
* @returns yes or no. If Yes means this action is allowed for the currently logged in user. If no means this action is not allowed for the currently logged in user
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$role = $userPrivilegesModel->getRoleDetail();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$sharingPrivilegesModule = $sharingPrivileges['permission'][$moduleName];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$permissionsRoleForRelatedField = $role->get('permissionsrelatedfield');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function isPermittedBySharing($moduleName, $tabId, $actionId, $recordId, $userId)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($read['GROUP'][$ownerId])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
//Checking for vtiger_tab permission
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ((0 == $userPrivileges['profile_global_permission'][1] || 0 == $userPrivileges['profile_global_permission'][2]) && (3 == $actionId || 4 == $actionId)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!isset($userPrivileges['profile_tabs_permission'][$tabId]) || 0 != $userPrivileges['profile_tabs_permission'][$tabId]) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$isPermittedPrivateRecord = true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::$isPermittedLevel = 'SEC_ACTION_DOES_NOT_EXIST';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\in_array($recOwnId, $userPrivileges['groups'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$shownerIds = Fields\SharedOwner::getById($record);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
//Checking for view all permission
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::$isPermittedLevel = 'SEC_MODULE_IS_OWNEDBY';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$level = 'SEC_PRIVATE_RECORD_SHARED_OWNER';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\App\Config::security('PERMITTED_BY_RECORD_HIERARCHY')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::$isPermittedLevel = 'SEC_ADVANCED_PERMISSION_YES';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::$isPermittedLevel = 'SEC_RECORD_HIERARCHY_USER';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (($modules = \App\Config::security('permittedModulesByCreatorField')) && \in_array($moduleName, $modules) && $userId === $recordMetaData['smcreatorid']) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $permission;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param $tabId -- Tab Id:: Type integer
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\strlen($userPrivileges['profile_action_permission'][$tabId][$actionId]) < 1 && '' === $userPrivileges['profile_action_permission'][$tabId][$actionId]) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (0 != $userPrivileges['profile_action_permission'][$tabId][$actionId] && '' != $userPrivileges['profile_action_permission'][$tabId][$actionId]) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('Exiting isPermitted method ... - SEC_RECORD_SHARED_OWNER');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 0:
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('Exiting isPermitted method ... - SEC_RECORD_DOES_NOT_EXIST');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordMetaData = \vtlib\Functions::getCRMRecordMetadata($recordId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$level = 'SEC_PRIVATE_RECORD_OWNER_CURRENT_GROUP';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::$isPermittedLevel = $level;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('Exiting isPermitted method ... - SEC_ADVANCED_PERMISSION_NO');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($userId === $recOwnId) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param $actionId -- Action Id:: Type integer
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userPrivilegesModel = \Users_Privileges_Model::getInstanceById($userId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$read = $sharingPrivilegesModule['read'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::$isPermittedLevel = 'SEC_RECORD_OWNER_CURRENT_USER';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\in_array($ownerId, $userids)) {
- Exclude checks
Line exceeds 120 characters; contains 178 characters Open
if (((3 == $actionId || 4 == $actionId) && 0 != $role->get('previewrelatedrecord')) || ((0 == $actionId || 1 == $actionId) && 0 != $role->get('editrelatedrecord'))) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
//Checking if the Record Owner is the Subordinate User
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($permissionsRelatedField as $row) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$relatedPermission = static::isPermittedBySharing($recordMetaData['setype'], Module::getModuleId($recordMetaData['setype']), $actionId, $parentRecord, $userId);
- Exclude checks
Line exceeds 120 characters; contains 129 characters Open
$relatedPermission = static::isPermitted($recordMetaData['setype'], 'DetailView', $parentRecord);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!isset($sharingPrivileges['permission'][$moduleName])) {
- Exclude checks
Line exceeds 120 characters; contains 196 characters Open
$relatedPermission = static::isPermittedBySharing($recordMetaData['setype'], Module::getModuleId($recordMetaData['setype']), $actionId, $parentRecord, $userId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('Users' == $ownerType) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
//Checking the Read Sharing Permission Array in Groups Users
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('Exiting isPermitted method ... - SEC_RECORD_HIERARCHY_USER');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $userId
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param $moduleName -- Module Name:: Type varchar
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!isset($sharingPrivileges['permission'][$moduleName])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
//Checking in Group Users
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\in_array($relOwnerId, $userids)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return false;
- Exclude checks
Line exceeds 120 characters; contains 168 characters Open
* @returns yes or no. If Yes means this action is allowed for the currently logged in user. If no means this action is not allowed for the currently logged in user
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace("Entering isReadWritePermittedBySharing($moduleName,$tabId,$actionId,$recordId,$userId) method ...");
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($write['ROLE'] as $userids) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('Exiting isReadWritePermittedBySharing method ...');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $type
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\is_array($relatedModuleArray)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('Users' == $relOwnerType) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
//Checking in Role Users
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $moduleName Module name
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function setUpdater($moduleName, $record = false, $priority = false, $type = 1)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\in_array($relOwnerId, $userids)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($readRelated['GROUP'][$relOwnerId])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\in_array($ownerId, $userids)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$relOwnerId = $rel_id;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Add to global permissions update queue.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $priority
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
//Checking for the Related Sharing Permission
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($parRecordOwner as $rel_type => $rel_id) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
//Checking in Group Users
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$sharingPrivileges = \App\User::getSharingFile($userId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$relOwnerType = $rel_type;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$relOwnerType = $rel_type;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param $actionId -- Action Id:: Type integer
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @returns yes or no. If Yes means this action is allowed for the currently logged in user. If no means this action is not allowed for the currently logged in user
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$write = $sharingPrivilegesModule['write'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($sharingPrivileges['relatedModuleShare'][$tabId] as $parModId) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($parRecordOwner as $rel_type => $rel_id) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('Users' == $relOwnerType) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('Exiting isReadWritePermittedBySharing method ...');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($sharingPrivileges['relatedModuleShare'][$tabId])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param $tabId -- Tab Id:: Type integer
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Line exceeds 120 characters; contains 133 characters Open
if (isset($sharingPrivileges['relatedModuleShare'][$tabId]) && \is_array($sharingPrivileges['relatedModuleShare'][$tabId])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($parRecordOwner)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$parModName = Module::getModuleName($parModId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $record If type = 1 starting number if type = 0 record ID
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$readRelated = $sharingPrivileges['permission'][$parModName . '_' . $moduleName]['read'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($readRelated['ROLE'] as $userids) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('Exiting isReadPermittedBySharing method ...');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif ('Groups' == $ownerType) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('Exiting isReadWritePermittedBySharing method ...');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
//Checking for the Related Sharing Permission
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$relOwnerType = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$relatedModuleArray = null;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$relOwnerType = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($write['GROUP'] as $userids) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('Exiting isReadWritePermittedBySharing method ...');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($write['GROUP'][$ownerId])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('Exiting isReadWritePermittedBySharing method ...');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('Exiting isReadWritePermittedBySharing method ...');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $userId
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordMetaData = \vtlib\Functions::getCRMRecordMetadata($recordId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$relatedModuleArray = $sharingPrivileges['relatedModuleShare'][$tabId];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$parRecordOwner = PrivilegeUtil::getParentRecordOwner($tabId, $parModId, $recordId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** Function to check if the currently logged in user has Write Access due to Sharing for the specified record.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('Users' == $ownerType) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
PrivilegeUpdater::setUpdater($moduleName, $record, $priority, $type);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
//Checking in Role Users
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($readRelated['GROUP'] as $userids) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($sharingPrivileges['relatedModuleShare'][$tabId]) && \is_array($sharingPrivileges['relatedModuleShare'][$tabId])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($writeRelated['GROUP'] as $userids) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($writeRelated['GROUP'][$relOwnerId])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$relOwnerId = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param $recordid -- Record Id:: Type integer
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function isReadWritePermittedBySharing($moduleName, $tabId, $actionId, $recordId, $userId)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
//Checking the Write Sharing Permission Array in Role Users
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$writeRelated = $sharingPrivileges['permission'][$parModName . '_' . $moduleName]['write'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($relatedModuleArray as $parModId) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\count($parRecordOwner) > 0) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$parModName = Module::getModuleName($parModId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('Exiting isReadPermittedBySharing method ...');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('Exiting isReadPermittedBySharing method ...');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$ownerId = $recordMetaData['smownerid'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$parRecordOwner = PrivilegeUtil::getParentRecordOwner($tabId, $parModId, $recordId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($writeRelated['ROLE'] as $userids) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\in_array($relOwnerId, $userids)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('Exiting isReadWritePermittedBySharing method ...');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
PrivilegeUpdater::setAllUpdater();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('Exiting isReadPermittedBySharing method ...');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$relOwnerId = $rel_id;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\in_array($relOwnerId, $userids)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('Exiting isReadPermittedBySharing method ...');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $recordId
- Exclude checks
Line exceeds 120 characters; contains 125 characters Open
\App\Log::trace("Entering isReadWritePermittedBySharing($moduleName,$tabId,$actionId,$recordId,$userId) method ...");
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$sharingPrivilegesModule = $sharingPrivileges['permission'][$moduleName];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\in_array($ownerId, $userids)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($sharingPrivileges['permission'][$parModName . '_' . $moduleName])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$relOwnerId = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function setAllUpdater()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($sharingPrivileges['permission'][$parModName . '_' . $moduleName])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$ownerType = \App\Fields\Owner::getType($ownerId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
//Checking the Write Sharing Permission Array in Groups Users
- Exclude checks
The variable $rel_id is not named in camelCase. Open
public static function isReadPermittedBySharing($moduleName, $tabId, $actionId, $recordId, $userId)
{
\App\Log::trace("Entering isReadPermittedBySharing($moduleName,$tabId,$actionId,$recordId,$userId) method ...");
$sharingPrivileges = \App\User::getSharingFile($userId);
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $rel_id is not named in camelCase. Open
public static function isReadPermittedBySharing($moduleName, $tabId, $actionId, $recordId, $userId)
{
\App\Log::trace("Entering isReadPermittedBySharing($moduleName,$tabId,$actionId,$recordId,$userId) method ...");
$sharingPrivileges = \App\User::getSharingFile($userId);
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $rel_type is not named in camelCase. Open
public static function isReadPermittedBySharing($moduleName, $tabId, $actionId, $recordId, $userId)
{
\App\Log::trace("Entering isReadPermittedBySharing($moduleName,$tabId,$actionId,$recordId,$userId) method ...");
$sharingPrivileges = \App\User::getSharingFile($userId);
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $rel_type is not named in camelCase. Open
public static function isReadPermittedBySharing($moduleName, $tabId, $actionId, $recordId, $userId)
{
\App\Log::trace("Entering isReadPermittedBySharing($moduleName,$tabId,$actionId,$recordId,$userId) method ...");
$sharingPrivileges = \App\User::getSharingFile($userId);
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $rel_type is not named in camelCase. Open
public static function isReadWritePermittedBySharing($moduleName, $tabId, $actionId, $recordId, $userId)
{
\App\Log::trace("Entering isReadWritePermittedBySharing($moduleName,$tabId,$actionId,$recordId,$userId) method ...");
$sharingPrivileges = \App\User::getSharingFile($userId);
if (!isset($sharingPrivileges['permission'][$moduleName])) {
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $rel_id is not named in camelCase. Open
public static function isReadWritePermittedBySharing($moduleName, $tabId, $actionId, $recordId, $userId)
{
\App\Log::trace("Entering isReadWritePermittedBySharing($moduleName,$tabId,$actionId,$recordId,$userId) method ...");
$sharingPrivileges = \App\User::getSharingFile($userId);
if (!isset($sharingPrivileges['permission'][$moduleName])) {
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $rel_id is not named in camelCase. Open
public static function isReadWritePermittedBySharing($moduleName, $tabId, $actionId, $recordId, $userId)
{
\App\Log::trace("Entering isReadWritePermittedBySharing($moduleName,$tabId,$actionId,$recordId,$userId) method ...");
$sharingPrivileges = \App\User::getSharingFile($userId);
if (!isset($sharingPrivileges['permission'][$moduleName])) {
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $rel_type is not named in camelCase. Open
public static function isReadWritePermittedBySharing($moduleName, $tabId, $actionId, $recordId, $userId)
{
\App\Log::trace("Entering isReadWritePermittedBySharing($moduleName,$tabId,$actionId,$recordId,$userId) method ...");
$sharingPrivileges = \App\User::getSharingFile($userId);
if (!isset($sharingPrivileges['permission'][$moduleName])) {
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}