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