ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
AddUserIdToPositionInOrgUnit.php
Go to the documentation of this file.
1<?php
2
20
21use ilObject2;
22use ilObjUser;
24
30{
31 protected function run(array $params): bool
32 {
33 $position_id = $params[self::POSITION_ID];
35 $orgu_ref_id = $params[self::ORGU_REF_ID];
36
38 $this->addError("User does not exist");
39 } elseif (!$this->positionRepo->getSingle($position_id, 'id') instanceof ilOrgUnitPosition) {
40 $this->addError("Position does not exist");
41 } elseif (ilObject2::_lookupType($orgu_ref_id, true) !== 'orgu') {
42 $this->addError("OrgUnit does not exist");
43 } else {
44 $assignment = $this->assignmentRepo->get($user_id, $position_id, $orgu_ref_id);
45 }
46
47 return true;
48 }
49
50 public function getName(): string
51 {
52 return "addUserToPositionInOrgUnit";
53 }
54
55 protected function getAdditionalInputParams(): array
56 {
57 return array(self::POSITION_ID => Base::TYPE_INT,
58 self::USR_ID => Base::TYPE_INT,
59 self::ORGU_REF_ID => Base::TYPE_INT
60 );
61 }
62
63 public function getOutputParams(): array
64 {
65 return [];
66 }
67
68 public function getDocumentation(): string
69 {
70 return "Adds a user to a position in a orgunit";
71 }
72}
getOutputParams()
Get the output parameters in the same format as the input parameters.
User class.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupType(int $id, bool $reference=false)
static _exists(int $id, bool $reference=false, ?string $type=null)
checks if an object exists in object_data
Class ilOrgUnitPosition.
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
Definition: ltiregstart.php:31
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...