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