|
44 | 44 | use CommonTreeDropdown;
|
45 | 45 | use ITILCategory;
|
46 | 46 | use Entity;
|
| 47 | +use Profile_User; |
47 | 48 | use User;
|
48 | 49 | use Group;
|
49 | 50 | use Group_Ticket;
|
@@ -251,6 +252,38 @@ public function buildParams($rand = null) {
|
251 | 252 |
|
252 | 253 | case User::class:
|
253 | 254 | $dparams['right'] = 'all';
|
| 255 | + $currentEntity = Session::getActiveEntity(); |
| 256 | + $ancestorEntities = getAncestorsOf(Entity::getTable(), $currentEntity); |
| 257 | + switch ($decodedValues['entity_restrict']) { |
| 258 | + case self::ENTITY_RESTRICT_FORM: |
| 259 | + $form = new PluginFormcreatorForm(); |
| 260 | + $form->getFromDBByQuestion($this->getQuestion()); |
| 261 | + $currentEntity = $form->fields['entities_id']; |
| 262 | + $ancestorEntities = getAncestorsOf(Entity::getTable(), $currentEntity); |
| 263 | + break; |
| 264 | + |
| 265 | + case self::ENTITY_RESTRICT_BOTH: |
| 266 | + $form = new PluginFormcreatorForm(); |
| 267 | + $form->getFromDBByQuestion($this->getQuestion()); |
| 268 | + $currentEntity = [$currentEntity, $form->fields['entities_id']]; |
| 269 | + $ancestorEntities = array_merge($ancestorEntities, getAncestorsOf(Entity::getTable(), $currentEntity)); |
| 270 | + break; |
| 271 | + } |
| 272 | + $where = ['OR' => []]; |
| 273 | + $where['OR'][] = ['entities_id' => $currentEntity]; |
| 274 | + if (count($ancestorEntities) > 0) { |
| 275 | + $where['OR'][] = [ |
| 276 | + 'entities_id' => $ancestorEntities, |
| 277 | + 'is_recursive' => '1', |
| 278 | + ]; |
| 279 | + } |
| 280 | + $dparams_cond_crit = [ |
| 281 | + 'id' => new QuerySubQuery([ |
| 282 | + 'SELECT' => 'users_id', |
| 283 | + 'FROM' => Profile_User::getTable(), |
| 284 | + 'WHERE' => $where, |
| 285 | + ]) |
| 286 | + ]; |
254 | 287 | break;
|
255 | 288 |
|
256 | 289 | case ITILCategory::class:
|
|
0 commit comments