ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilGlossaryTermPermission 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 ilGlossaryTermPermission:

Public Member Functions

 checkPermission (string $a_perm, int $a_term_id)
 

Static Public Member Functions

static getInstance ()
 

Protected Member Functions

 getGlossaryIdForTerm (int $a_term_id)
 

Protected Attributes

ilObjUser $user
 
ilAccessHandler $access
 
array $glossary_id = array()
 
array $permission = array()
 
ilLogger $log
 

Private Member Functions

 __construct ()
 

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 Permission checker for terms

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 26 of file class.ilGlossaryTermPermission.php.

Constructor & Destructor Documentation

◆ __construct()

ilGlossaryTermPermission::__construct ( )
private

Definition at line 35 of file class.ilGlossaryTermPermission.php.

References $DIC, ILIAS\Repository\access(), ilLoggerFactory\getLogger(), and ILIAS\Repository\user().

36  {
37  global $DIC;
38 
39  $this->user = $DIC->user();
40  $this->access = $DIC->access();
41 
42  $this->log = ilLoggerFactory::getLogger('glo');
43  }
static getLogger(string $a_component_id)
Get component logger.
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

Member Function Documentation

◆ checkPermission()

ilGlossaryTermPermission::checkPermission ( string  $a_perm,
int  $a_term_id 
)

Definition at line 50 of file class.ilGlossaryTermPermission.php.

References $ref_id, ilObject\_getAllReferences(), ILIAS\Repository\access(), and getGlossaryIdForTerm().

53  : bool {
54  $this->log->debug("check permission " . $a_perm . " for " . $a_term_id . ".");
55  $glo_id = $this->getGlossaryIdForTerm($a_term_id);
56  if (!isset($this->permission[$a_perm][$glo_id])) {
57  $this->permission[$a_perm][$glo_id] = false;
58  $this->log->debug("...checking references");
59  foreach (ilObject::_getAllReferences($glo_id) as $ref_id) {
60  $this->log->debug("..." . $ref_id);
61  if ($this->permission[$a_perm][$glo_id] == true) {
62  continue;
63  }
64  if ($this->access->checkAccess($a_perm, "", $ref_id)) {
65  $this->permission[$a_perm][$glo_id] = true;
66  }
67  }
68  }
69  $this->log->debug("...return " . ((int) $this->permission[$a_perm][$glo_id]));
70  return $this->permission[$a_perm][$glo_id];
71  }
static _getAllReferences(int $id)
get all reference ids for object ID
$ref_id
Definition: ltiauth.php:67
+ Here is the call graph for this function:

◆ getGlossaryIdForTerm()

ilGlossaryTermPermission::getGlossaryIdForTerm ( int  $a_term_id)
protected

Definition at line 73 of file class.ilGlossaryTermPermission.php.

References ilGlossaryTerm\_lookGlossaryID().

Referenced by checkPermission().

73  : int
74  {
75  if (!isset($this->glossary_id[$a_term_id])) {
76  $this->glossary_id[$a_term_id] = ilGlossaryTerm::_lookGlossaryID($a_term_id);
77  }
78  return $this->glossary_id[$a_term_id];
79  }
static _lookGlossaryID(int $term_id)
get glossary id form term id
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getInstance()

static ilGlossaryTermPermission::getInstance ( )
static

Definition at line 45 of file class.ilGlossaryTermPermission.php.

Referenced by ilTermListTableGUI\__construct(), and ilObjGlossaryGUI\__construct().

45  : self
46  {
47  return new self();
48  }
+ Here is the caller graph for this function:

Field Documentation

◆ $access

ilAccessHandler ilGlossaryTermPermission::$access
protected

Definition at line 29 of file class.ilGlossaryTermPermission.php.

◆ $glossary_id

array ilGlossaryTermPermission::$glossary_id = array()
protected

Definition at line 31 of file class.ilGlossaryTermPermission.php.

◆ $log

ilLogger ilGlossaryTermPermission::$log
protected

Definition at line 33 of file class.ilGlossaryTermPermission.php.

◆ $permission

array ilGlossaryTermPermission::$permission = array()
protected

Definition at line 32 of file class.ilGlossaryTermPermission.php.

◆ $user

ilObjUser ilGlossaryTermPermission::$user
protected

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


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