ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilOrgUnitPermissionQueries Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Collaboration diagram for ilOrgUnitPermissionQueries:

Static Public Member Functions

static getTemplateSetForContextName (string $context_name, string $position_id, bool $editable=false)
 
static hasLocalSet (int $ref_id, int $position_id)
 
static getAllTemplateSetsForAllActivedContexts (int $position_id, bool $editable=false)
 

Static Private Member Functions

static getContextByRefId (int $ref_id)
 
static assertRefIdAndPositionIdIsNotNull (int $ref_id, int $position_id)
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Class ilOrgUnitPermissionQueries

Author
Fabian Schmid fs@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch

Definition at line 23 of file class.ilOrgUnitPermissionQueries.php.

Member Function Documentation

◆ assertRefIdAndPositionIdIsNotNull()

static ilOrgUnitPermissionQueries::assertRefIdAndPositionIdIsNotNull ( int  $ref_id,
int  $position_id 
)
staticprivate
Exceptions
ilException

Definition at line 225 of file class.ilOrgUnitPermissionQueries.php.

225  : void
226  {
227  if (!$ref_id) {
228  throw new ilException('$ref_id cannot be null');
229  }
230  if (!$position_id) {
231  throw new ilException('$position_id cannot be null');
232  }
233  }
$ref_id
Definition: ltiauth.php:67

◆ getAllTemplateSetsForAllActivedContexts()

static ilOrgUnitPermissionQueries::getAllTemplateSetsForAllActivedContexts ( int  $position_id,
bool  $editable = false 
)
static
Returns
ilOrgUnitPermission[]
Exceptions
ilException

Definition at line 193 of file class.ilOrgUnitPermissionQueries.php.

References $context, and ilOrgUnitGlobalSettings\getInstance().

Referenced by ilOrgUnitDefaultPermissionGUI\index(), and ilOrgUnitDefaultPermissionGUI\update().

193  : array
194  {
195  $activated_components = [];
196  foreach (ilOrgUnitGlobalSettings::getInstance()->getPositionSettings() as $ilOrgUnitObjectPositionSetting) {
197  if ($ilOrgUnitObjectPositionSetting->isActive()) {
198  $activated_components[] = $ilOrgUnitObjectPositionSetting->getType();
199  }
200  }
201  $sets = [];
202  foreach ($activated_components as $context) {
203  $sets[] = self::getTemplateSetForContextName($context, $position_id, $editable);
204  }
205 
206  return $sets;
207  }
$context
Definition: webdav.php:29
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getContextByRefId()

static ilOrgUnitPermissionQueries::getContextByRefId ( int  $ref_id)
staticprivate
Exceptions
ilException

Definition at line 212 of file class.ilOrgUnitPermissionQueries.php.

References $context, and ilOrgUnitOperationContextQueries\findByRefId().

213  {
215  if (!$context) {
216  throw new ilException('Context not found');
217  }
218 
219  return $context;
220  }
$context
Definition: webdav.php:29
$ref_id
Definition: ltiauth.php:67
+ Here is the call graph for this function:

◆ getTemplateSetForContextName()

static ilOrgUnitPermissionQueries::getTemplateSetForContextName ( string  $context_name,
string  $position_id,
bool  $editable = false 
)
static
Exceptions
ilException

Definition at line 28 of file class.ilOrgUnitPermissionQueries.php.

References $context, ilOrgUnitOperationContextQueries\findByName(), ilOrgUnitPermission\PARENT_TEMPLATE, and ActiveRecord\where().

Referenced by ilObjEmployeeTalkAccess\canCreate(), ilObjEmployeeTalkAccess\getCurrentUsersId(), and ilEmployeeTalkMyStaffListGUI\loadActionBar().

29  {
31  if (!$context) {
32  throw new ilException('No context found');
33  }
34  if (!$position_id) {
35  throw new ilException('$position_id cannot be null');
36  }
37 
38  $template_set = ilOrgUnitPermission::where([
40  'context_id' => $context->getId(),
41  'position_id' => $position_id,
42  ])->first();
43 
44  if (!$template_set) {
45  $template_set = new ilOrgUnitPermission();
46  $template_set->setParentId(ilOrgUnitPermission::PARENT_TEMPLATE);
47  $template_set->setContextId($context->getId());
48  $template_set->setPositionId($position_id);
49  $template_set->setNewlyCreated(true);
50  $template_set->create();
51  }
52 
53  $template_set->setProtected(!$editable);
54  $template_set->afterObjectLoad();
55  return $template_set;
56  }
$context
Definition: webdav.php:29
static where($where, $operator=null)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hasLocalSet()

static ilOrgUnitPermissionQueries::hasLocalSet ( int  $ref_id,
int  $position_id 
)
static

Definition at line 58 of file class.ilOrgUnitPermissionQueries.php.

References $context, $ref_id, ilOrgUnitGlobalSettings\getInstance(), and ActiveRecord\where().

Referenced by ilOrgUnitPermissionTableGUI\fillHeaderCommand().

58  : bool
59  {
61  'parent_id' => $ref_id,
62  'position_id' => $position_id,
63  ])->hasSets());
64  }
static where($where, $operator=null)
$ref_id
Definition: ltiauth.php:67
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

The documentation for this class was generated from the following file: