ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
RemoveUserIdFromPositionInOrgUnit.php
Go to the documentation of this file.
1<?php
2
20
21use ilObject2;
22use ilObjUser;
24use LogicException;
25use SoapFault;
26
32{
36 protected function run(array $params): bool
37 {
38 $position_id = $params[self::POSITION_ID];
40 $orgu_ref_id = $params[self::ORGU_REF_ID];
41
43 throw new LogicException("User does not exist");
44 }
45 if (!$this->positionRepo->getSingle($position_id, 'id') instanceof ilOrgUnitPosition) {
46 throw new LogicException("Position does not exist");
47 }
48 if (ilObject2::_lookupType($orgu_ref_id, true) !== 'orgu') {
49 throw new LogicException("OrgUnit does not exist");
50 } else {
51 $assignment = $this->assignmentRepo->find($user_id, $position_id, $orgu_ref_id);
52 if ($assignment) {
53 $this->assignmentRepo->delete($assignment);
54 } else {
55 $this->addError("No assignment found");
56 }
57 }
58
59 return true;
60 }
61
65 public function getName(): string
66 {
67 return "removeUserFromPositionInOrgUnit";
68 }
69
70 protected function getAdditionalInputParams(): array
71 {
72 return array(self::POSITION_ID => Base::TYPE_INT,
73 self::USR_ID => Base::TYPE_INT,
74 self::ORGU_REF_ID => Base::TYPE_INT
75 );
76 }
77
78 public function getOutputParams(): array
79 {
80 return [];
81 }
82
83 public function getDocumentation(): string
84 {
85 return "Removes a user from a position in a orgunit";
86 }
87}
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...