ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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

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 {
74 $this->permission[$a_perm][$glo_id] = false;
75 $this->log->debug("...checking references");
76 foreach (ilObject::_getAllReferences($glo_id) as $ref_id)
77 {
78 $this->log->debug("...".$ref_id);
79 if ($this->permission[$a_perm][$glo_id] == true)
80 {
81 continue;
82 }
83 if ($this->access->checkAccess($a_perm, "", $ref_id))
84 {
85 $this->permission[$a_perm][$glo_id] = true;
86 }
87 }
88 }
89 $this->log->debug("...return ".((int) $this->permission[$a_perm][$glo_id]));
90 return $this->permission[$a_perm][$glo_id];
91 }
getGlossaryIdForTerm($a_term_id)
Get glossary for term.
static _getAllReferences($a_id)
get all reference ids of object
$ref_id
Definition: sahs_server.php:39

References $ref_id, 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 99 of file class.ilGlossaryTermPermission.php.

100 {
101 if (!isset($this->glossary_id[$a_term_id]))
102 {
103 include_once("./Modules/Glossary/classes/class.ilGlossaryTerm.php");
104 $this->glossary_id[$a_term_id] = ilGlossaryTerm::_lookGlossaryID($a_term_id);
105 }
106 return $this->glossary_id[$a_term_id];
107 }
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: