ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilGlossaryTermPermission Class Reference

Permission checker for terms. More...

+ Collaboration diagram for ilGlossaryTermPermission:

Public Member Functions

 checkPermission ($a_perm, $a_term_id)
 Check permission. More...
 

Static Public Member Functions

static getInstance ()
 Get instance. More...
 

Protected Member Functions

 getGlossaryIdForTerm ($a_term_id)
 Get glossary for term. More...
 

Protected Attributes

 $user
 
 $access
 
 $glossary_id = array()
 
 $permission = array()
 
 $log
 

Private Member Functions

 __construct ()
 ilGlossaryTermPermission constructor. More...
 

Detailed Description

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 12 of file class.ilGlossaryTermPermission.php.

Constructor & Destructor Documentation

◆ __construct()

ilGlossaryTermPermission::__construct ( )
private

ilGlossaryTermPermission constructor.

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

43 {
44 global $DIC;
45
46 $this->user = $DIC->user();
47 $this->access = $DIC->access();
48
49 $this->log = ilLoggerFactory::getLogger('glo');
50 }
user()
Definition: user.php:4
static getLogger($a_component_id)
Get component logger.
global $DIC
Definition: saml.php:7

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

+ Here is the call graph for this function:

Member Function Documentation

◆ checkPermission()

ilGlossaryTermPermission::checkPermission (   $a_perm,
  $a_term_id 
)

Check permission.

Parameters
string$a_perm
int$a_term_id
Returns
bool

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

69 {
70 $this->log->debug("check permission " . $a_perm . " for " . $a_term_id . ".");
71 $glo_id = $this->getGlossaryIdForTerm($a_term_id);
72 if (!isset($this->permission[$a_perm][$glo_id])) {
73 $this->permission[$a_perm][$glo_id] = false;
74 $this->log->debug("...checking references");
75 foreach (ilObject::_getAllReferences($glo_id) as $ref_id) {
76 $this->log->debug("..." . $ref_id);
77 if ($this->permission[$a_perm][$glo_id] == true) {
78 continue;
79 }
80 if ($this->access->checkAccess($a_perm, "", $ref_id)) {
81 $this->permission[$a_perm][$glo_id] = true;
82 }
83 }
84 }
85 $this->log->debug("...return " . ((int) $this->permission[$a_perm][$glo_id]));
86 return $this->permission[$a_perm][$glo_id];
87 }
getGlossaryIdForTerm($a_term_id)
Get glossary for term.
static _getAllReferences($a_id)
get all reference ids of object

References ilObject\_getAllReferences(), and getGlossaryIdForTerm().

+ Here is the call graph for this function:

◆ getGlossaryIdForTerm()

ilGlossaryTermPermission::getGlossaryIdForTerm (   $a_term_id)
protected

Get glossary for term.

Parameters
int$a_term_id
Returns
int

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

96 {
97 if (!isset($this->glossary_id[$a_term_id])) {
98 include_once("./Modules/Glossary/classes/class.ilGlossaryTerm.php");
99 $this->glossary_id[$a_term_id] = ilGlossaryTerm::_lookGlossaryID($a_term_id);
100 }
101 return $this->glossary_id[$a_term_id];
102 }
static _lookGlossaryID($term_id)
get glossary id form term id

References ilGlossaryTerm\_lookGlossaryID().

Referenced by checkPermission().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getInstance()

static ilGlossaryTermPermission::getInstance ( )
static

Get instance.

Returns
ilGlossaryTermPermission

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

57 {
58 return new self();
59 }

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

+ Here is the caller graph for this function:

Field Documentation

◆ $access

ilGlossaryTermPermission::$access
protected

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

◆ $glossary_id

ilGlossaryTermPermission::$glossary_id = array()
protected

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

◆ $log

ilGlossaryTermPermission::$log
protected

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

◆ $permission

ilGlossaryTermPermission::$permission = array()
protected

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

◆ $user

ilGlossaryTermPermission::$user
protected

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


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