mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-03 22:32:40 +08:00
Enhanced RBAC Rule assignment
* #11254 Enhanced RBAC Rule assignment * Enhanced RBAC Rule assignment
This commit is contained in:
committed by
Alexander Makarov
parent
bfa7c7b13b
commit
0e17d652dc
@ -115,6 +115,11 @@ abstract class BaseManager extends Component implements ManagerInterface
|
||||
public function add($object)
|
||||
{
|
||||
if ($object instanceof Item) {
|
||||
if ($object->ruleName && $this->getRule($object->ruleName) === null) {
|
||||
$rule = \Yii::createObject($object->ruleName);
|
||||
$rule->name = $object->ruleName;
|
||||
$this->addRule($rule);
|
||||
}
|
||||
return $this->addItem($object);
|
||||
} elseif ($object instanceof Rule) {
|
||||
return $this->addRule($object);
|
||||
@ -143,6 +148,11 @@ abstract class BaseManager extends Component implements ManagerInterface
|
||||
public function update($name, $object)
|
||||
{
|
||||
if ($object instanceof Item) {
|
||||
if ($object->ruleName && $this->getRule($object->ruleName) === null) {
|
||||
$rule = \Yii::createObject($object->ruleName);
|
||||
$rule->name = $object->ruleName;
|
||||
$this->addRule($rule);
|
||||
}
|
||||
return $this->updateItem($name, $object);
|
||||
} elseif ($object instanceof Rule) {
|
||||
return $this->updateRule($name, $object);
|
||||
|
||||
Reference in New Issue
Block a user