| @@ 96-102 (lines=7) @@ | ||
| 93 | */ |
|
| 94 | public function setChild($parent, $child) |
|
| 95 | { |
|
| 96 | if (is_string($parent)) { |
|
| 97 | $name = $parent; |
|
| 98 | $parent = $this->getItem($parent); |
|
| 99 | if (is_null($parent)) { |
|
| 100 | throw new InvalidParamException("Unknown parent:$name at setChild"); |
|
| 101 | } |
|
| 102 | } |
|
| 103 | if (is_string($child)) { |
|
| 104 | $name = $child; |
|
| 105 | $child = $this->getItem($child); |
|
| @@ 103-109 (lines=7) @@ | ||
| 100 | throw new InvalidParamException("Unknown parent:$name at setChild"); |
|
| 101 | } |
|
| 102 | } |
|
| 103 | if (is_string($child)) { |
|
| 104 | $name = $child; |
|
| 105 | $child = $this->getItem($child); |
|
| 106 | if (is_null($child)) { |
|
| 107 | throw new InvalidParamException("Unknown child:$name at setChild"); |
|
| 108 | } |
|
| 109 | } |
|
| 110 | if (isset($this->children[$parent->name][$child->name])) { |
|
| 111 | return false; |
|
| 112 | } |
|
| @@ 126-132 (lines=7) @@ | ||
| 123 | */ |
|
| 124 | public function setAssignment($role, $userId) |
|
| 125 | { |
|
| 126 | if (is_string($role)) { |
|
| 127 | $name = $role; |
|
| 128 | $role = $this->getRole($role); |
|
| 129 | if (is_null($role)) { |
|
| 130 | throw new InvalidParamException("Unknown role:$name at setAssignment"); |
|
| 131 | } |
|
| 132 | } |
|
| 133 | if (isset($this->assignments[$userId][$role->name])) { |
|
| 134 | return false; |
|
| 135 | } |
|