29            throw new ilException(
'$position_id cannot be null');
 
   35            'position_id' => $position_id,
 
   41            $template_set->setContextId(
$context->getId());
 
   42            $template_set->setPositionId($position_id);
 
   43            $template_set->setNewlyCreated(
true);
 
   44            $template_set->create();
 
   45            $template_set->afterObjectLoad();
 
   48        $template_set->setProtected(!$editable);
 
   63            'parent_id' => $ref_id,
 
   64            'position_id' => $position_id,
 
   78    public static function getSetForRefId($ref_id, $position_id)
 
   86        $ilOrgUnitObjectPositionSetting = $ilOrgUnitGlobalSettings->getObjectPositionSettingsByType(
$context->getContext());
 
   88        if (!$ilOrgUnitObjectPositionSetting->isActive()) {
 
   96            'parent_id' => $ref_id,
 
   98            'position_id' => $position_id,
 
  100        if ($dedicated_set) {
 
  101            return $dedicated_set;
 
  115    public static function findOrCreateSetForRefId($ref_id, $position_id)
 
  125        $ilOrgUnitObjectPositionSetting = $ilOrgUnitGlobalSettings->getObjectPositionSettingsByType(
$context->getContext());
 
  127        if (!$ilOrgUnitObjectPositionSetting->isActive()) {
 
  132            'parent_id' => $ref_id,
 
  134            'position_id' => $position_id,
 
  136        if ($dedicated_set) {
 
  137            return $dedicated_set;
 
  143        $set->setProtected(
false);
 
  144        $set->setParentId($ref_id);
 
  145        $set->setPositionId($position_id);
 
  146        $set->setContextId(
$context->getId());
 
  147        $set->setOperations($template->getOperations());
 
  148        $set->setNewlyCreated(
true);
 
  162    public static function removeLocalSetForRefId($ref_id, $position_id)
 
  172        $ilOrgUnitObjectPositionSetting = $ilOrgUnitGlobalSettings->getObjectPositionSettingsByType(
$context->getContext());
 
  174        if (!$ilOrgUnitObjectPositionSetting->isActive()) {
 
  179            'parent_id' => $ref_id,
 
  181            'position_id' => $position_id,
 
  182            'protected' => 
false,
 
  184        if ($dedicated_set) {
 
  185            $dedicated_set->delete();
 
  203        $activated_components = [];
 
  205            if ($ilOrgUnitObjectPositionSetting->isActive()) {
 
  206                $activated_components[] = $ilOrgUnitObjectPositionSetting->getType();
 
  210        foreach ($activated_components as 
$context) {
 
  225        $q = 
'SELECT @OP_ID:= CONCAT("%\"",operation_id, "\"%") FROM il_orgu_op_contexts 
  226JOIN il_orgu_operations ON il_orgu_operations.context_id = il_orgu_op_contexts.id 
  227WHERE il_orgu_op_contexts.context IN(\'crs\', \'object\') AND operation_string = \'viewmembers\';';
 
  234        $db = 
$DIC->database();
 
  236        $q = 
'SELECT @CONTEXT_TYPE:= object_data.type 
  237                 FROM object_reference 
  238                 JOIN object_data ON object_data.obj_id = object_reference.obj_id 
  239                 WHERE object_reference.ref_id = %s;';
 
  240        $db->queryF($q, [
'integer'], [$ref_id]);
 
  242        $q = 
'SELECT @OP_ID:= CONCAT("%\"", il_orgu_operations.operation_id, "%\"") 
  243                                        FROM il_orgu_operations  
  244                                        JOIN il_orgu_op_contexts ON il_orgu_op_contexts.context = @CONTEXT_TYPE -- AND il_orgu_op_contexts.id = il_orgu_operations.context_id 
  245                                WHERE il_orgu_operations.operation_string = %s';
 
  246        $db->queryF($q, [
'text'], [$pos_perm]);
 
  247        $q = 
'SELECT * FROM il_orgu_permissions WHERE operations LIKE @OP_ID AND position_id = %s;';
 
  248        $r = $db->queryF($q, [
'integer'], [$position_id]);
 
  283            throw new ilException(
'$position_id cannot be null');
 
static where($where, $operator=null)
An exception for terminatinating execution or to throw for unit testing.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getInstance()
Get instance.
static findByRefId($ref_id)
static findByName($context_name)
Class ilOrgUnitPermissionQueries.
static hasLocalSet($ref_id, $position_id)
static getContextByRefId($ref_id)
static getAllowedOperationsOnRefIdAndPosition($ref_id, $position_id)
static getAllTemplateSetsForAllActivedContexts($position_id, $editable=false)
static checkRefIdAndPositionId($ref_id, $position_id)
static getTemplateSetForContextName($context_name, $position_id, $editable=false)
static getRelevantPermissionSetsForUserIdAndRefIdAndOperation($user_id, $ref_id, $operation_string)
Class ilOrgUnitPermissionGUI.
Class ilPositionPermissionsNotActive.