@@ 95-101 (lines=7) @@ | ||
92 | */ |
|
93 | public function setChild($parent, $child) |
|
94 | { |
|
95 | if (is_string($parent)) { |
|
96 | $name = $parent; |
|
97 | $parent = $this->getItem($parent); |
|
98 | if (is_null($parent)) { |
|
99 | throw new InvalidParamException("Unknown parent:$name at setChild"); |
|
100 | } |
|
101 | } |
|
102 | if (is_string($child)) { |
|
103 | $name = $child; |
|
104 | $child = $this->getItem($child); |
|
@@ 102-108 (lines=7) @@ | ||
99 | throw new InvalidParamException("Unknown parent:$name at setChild"); |
|
100 | } |
|
101 | } |
|
102 | if (is_string($child)) { |
|
103 | $name = $child; |
|
104 | $child = $this->getItem($child); |
|
105 | if (is_null($child)) { |
|
106 | throw new InvalidParamException("Unknown child:$name at setChild"); |
|
107 | } |
|
108 | } |
|
109 | if (isset($this->children[$parent->name][$child->name])) { |
|
110 | return false; |
|
111 | } |
|
@@ 118-124 (lines=7) @@ | ||
115 | ||
116 | public function setAssignment($role, $userId) |
|
117 | { |
|
118 | if (is_string($role)) { |
|
119 | $name = $role; |
|
120 | $role = $this->getRole($role); |
|
121 | if (is_null($role)) { |
|
122 | throw new InvalidParamException("Unknown role:$name at setAssignment"); |
|
123 | } |
|
124 | } |
|
125 | if (isset($this->assignments[$userId][$role->name])) { |
|
126 | return false; |
|
127 | } |