|
|
@ -74,7 +74,7 @@ class PhpManager extends Manager |
|
|
|
if (!isset($this->_items[$itemName])) { |
|
|
|
if (!isset($this->_items[$itemName])) { |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
/** @var $item Item */ |
|
|
|
/** @var Item $item */ |
|
|
|
$item = $this->_items[$itemName]; |
|
|
|
$item = $this->_items[$itemName]; |
|
|
|
Yii::trace('Checking permission: ' . $item->getName(), __METHOD__); |
|
|
|
Yii::trace('Checking permission: ' . $item->getName(), __METHOD__); |
|
|
|
if (!isset($params['userId'])) { |
|
|
|
if (!isset($params['userId'])) { |
|
|
@ -85,7 +85,7 @@ class PhpManager extends Manager |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
if (isset($this->_assignments[$userId][$itemName])) { |
|
|
|
if (isset($this->_assignments[$userId][$itemName])) { |
|
|
|
/** @var $assignment Assignment */ |
|
|
|
/** @var Assignment $assignment */ |
|
|
|
$assignment = $this->_assignments[$userId][$itemName]; |
|
|
|
$assignment = $this->_assignments[$userId][$itemName]; |
|
|
|
if ($this->executeBizRule($assignment->bizRule, $params, $assignment->data)) { |
|
|
|
if ($this->executeBizRule($assignment->bizRule, $params, $assignment->data)) { |
|
|
|
return true; |
|
|
|
return true; |
|
|
@ -113,9 +113,9 @@ class PhpManager extends Manager |
|
|
|
if (!isset($this->_items[$childName], $this->_items[$itemName])) { |
|
|
|
if (!isset($this->_items[$childName], $this->_items[$itemName])) { |
|
|
|
throw new Exception("Either '$itemName' or '$childName' does not exist."); |
|
|
|
throw new Exception("Either '$itemName' or '$childName' does not exist."); |
|
|
|
} |
|
|
|
} |
|
|
|
/** @var $child Item */ |
|
|
|
/** @var Item $child */ |
|
|
|
$child = $this->_items[$childName]; |
|
|
|
$child = $this->_items[$childName]; |
|
|
|
/** @var $item Item */ |
|
|
|
/** @var Item $item */ |
|
|
|
$item = $this->_items[$itemName]; |
|
|
|
$item = $this->_items[$itemName]; |
|
|
|
$this->checkItemChildType($item->type, $child->type); |
|
|
|
$this->checkItemChildType($item->type, $child->type); |
|
|
|
if ($this->detectLoop($itemName, $childName)) { |
|
|
|
if ($this->detectLoop($itemName, $childName)) { |
|
|
@ -270,14 +270,14 @@ class PhpManager extends Manager |
|
|
|
$items = []; |
|
|
|
$items = []; |
|
|
|
if ($userId === null) { |
|
|
|
if ($userId === null) { |
|
|
|
foreach ($this->_items as $name => $item) { |
|
|
|
foreach ($this->_items as $name => $item) { |
|
|
|
/** @var $item Item */ |
|
|
|
/** @var Item $item */ |
|
|
|
if ($item->type == $type) { |
|
|
|
if ($item->type == $type) { |
|
|
|
$items[$name] = $item; |
|
|
|
$items[$name] = $item; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} elseif (isset($this->_assignments[$userId])) { |
|
|
|
} elseif (isset($this->_assignments[$userId])) { |
|
|
|
foreach ($this->_assignments[$userId] as $assignment) { |
|
|
|
foreach ($this->_assignments[$userId] as $assignment) { |
|
|
|
/** @var $assignment Assignment */ |
|
|
|
/** @var Assignment $assignment */ |
|
|
|
$name = $assignment->itemName; |
|
|
|
$name = $assignment->itemName; |
|
|
|
if (isset($this->_items[$name]) && ($type === null || $this->_items[$name]->type == $type)) { |
|
|
|
if (isset($this->_items[$name]) && ($type === null || $this->_items[$name]->type == $type)) { |
|
|
|
$items[$name] = $this->_items[$name]; |
|
|
|
$items[$name] = $this->_items[$name]; |
|
|
@ -400,7 +400,7 @@ class PhpManager extends Manager |
|
|
|
{ |
|
|
|
{ |
|
|
|
$items = []; |
|
|
|
$items = []; |
|
|
|
foreach ($this->_items as $name => $item) { |
|
|
|
foreach ($this->_items as $name => $item) { |
|
|
|
/** @var $item Item */ |
|
|
|
/** @var Item $item */ |
|
|
|
$items[$name] = [ |
|
|
|
$items[$name] = [ |
|
|
|
'type' => $item->type, |
|
|
|
'type' => $item->type, |
|
|
|
'description' => $item->description, |
|
|
|
'description' => $item->description, |
|
|
@ -409,7 +409,7 @@ class PhpManager extends Manager |
|
|
|
]; |
|
|
|
]; |
|
|
|
if (isset($this->_children[$name])) { |
|
|
|
if (isset($this->_children[$name])) { |
|
|
|
foreach ($this->_children[$name] as $child) { |
|
|
|
foreach ($this->_children[$name] as $child) { |
|
|
|
/** @var $child Item */ |
|
|
|
/** @var Item $child */ |
|
|
|
$items[$name]['children'][] = $child->getName(); |
|
|
|
$items[$name]['children'][] = $child->getName(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -417,7 +417,7 @@ class PhpManager extends Manager |
|
|
|
|
|
|
|
|
|
|
|
foreach ($this->_assignments as $userId => $assignments) { |
|
|
|
foreach ($this->_assignments as $userId => $assignments) { |
|
|
|
foreach ($assignments as $name => $assignment) { |
|
|
|
foreach ($assignments as $name => $assignment) { |
|
|
|
/** @var $assignment Assignment */ |
|
|
|
/** @var Assignment $assignment */ |
|
|
|
if (isset($items[$name])) { |
|
|
|
if (isset($items[$name])) { |
|
|
|
$items[$name]['assignments'][$userId] = [ |
|
|
|
$items[$name]['assignments'][$userId] = [ |
|
|
|
'bizRule' => $assignment->bizRule, |
|
|
|
'bizRule' => $assignment->bizRule, |
|
|
@ -505,7 +505,7 @@ class PhpManager extends Manager |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
foreach ($this->_children[$childName] as $child) { |
|
|
|
foreach ($this->_children[$childName] as $child) { |
|
|
|
/** @var $child Item */ |
|
|
|
/** @var Item $child */ |
|
|
|
if ($this->detectLoop($itemName, $child->getName())) { |
|
|
|
if ($this->detectLoop($itemName, $child->getName())) { |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|