ILIAS  trunk Revision v11.0_alpha-1749-g1a06bdef097
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilObjBlogAccess Class Reference

Class ilObjBlogAccess. More...

+ Inheritance diagram for ilObjBlogAccess:
+ Collaboration diagram for ilObjBlogAccess:

Public Member Functions

 __construct ()
 
 canBeDelivered (ilWACPath $ilWACPath)
 
 _checkAccess (string $cmd, string $permission, int $ref_id, int $obj_id, ?int $user_id=null)
 
- Public Member Functions inherited from ilObjectAccess
 _checkAccess (string $cmd, string $permission, int $ref_id, int $obj_id, ?int $user_id=null)
 Checks whether a user may invoke a command or not (this method is called by ilAccessHandler::checkAccess) More...
 
 canBeDelivered (ilWACPath $ilWACPath)
 

Static Public Member Functions

static _getCommands ()
 
static _checkGoto (string $target)
 
static isCommentsExportPossible (int $blog_id)
 
- Static Public Member Functions inherited from ilObjectAccess
static _getCommands ()
 get commands More...
 
static _checkGoto (string $target)
 check whether goto script will succeed More...
 
static _isOffline (int $obj_id)
 Type-specific implementation of general status, has to be overwritten if object type does not support centralized offline handling. More...
 
static _preloadData (array $obj_ids, array $ref_ids)
 Preload data. More...
 

Protected Attributes

ilLanguage $lng
 
ilObjUser $user
 
ilAccessHandler $access
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilObjBlogAccess::__construct ( )

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

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

32  {
33  global $DIC;
34 
35  $this->user = $DIC->user();
36  $this->access = $DIC->access();
37  $this->lng = $DIC->language();
38  }
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:

Member Function Documentation

◆ _checkAccess()

ilObjBlogAccess::_checkAccess ( string  $cmd,
string  $permission,
int  $ref_id,
int  $obj_id,
?int  $user_id = null 
)

Definition at line 133 of file class.ilObjBlogAccess.php.

References $user_id, ILIAS\Repository\access(), ilAccessInfo\IL_NO_OBJECT_ACCESS, and ILIAS\Repository\lng().

133  : bool
134  {
135  switch ($permission) {
136  case "visible":
137  case "read":
138  if (self::_isOffline($obj_id) && !$this->access->checkAccessOfUser($user_id, "write", "", $ref_id)) {
139  $this->access->addInfoItem(ilAccessInfo::IL_NO_OBJECT_ACCESS, $this->lng->txt("offline"));
140  return false;
141  }
142  break;
143  }
144  return true;
145  }
$ref_id
Definition: ltiauth.php:65
+ Here is the call graph for this function:

◆ _checkGoto()

static ilObjBlogAccess::_checkGoto ( string  $target)
static

Definition at line 51 of file class.ilObjBlogAccess.php.

References $DIC, and ilSharedResourceGUI\hasAccess().

51  : bool
52  {
53  global $DIC;
54 
55  $ilAccess = $DIC->access();
56 
57  $t_arr = explode("_", $target);
58 
59  if (substr($target, -3) === "wsp") {
60  return ilSharedResourceGUI::hasAccess((int) $t_arr[1]);
61  }
62 
63  if ($t_arr[0] !== "blog" || ((int) $t_arr[1]) <= 0) {
64  return false;
65  }
66 
67  // #12648
68  if ($ilAccess->checkAccess("read", "", (int) $t_arr[1]) ||
69  $ilAccess->checkAccess("visible", "", (int) $t_arr[1])) {
70  return true;
71  }
72  return false;
73  }
global $DIC
Definition: shib_login.php:22
static hasAccess(int $a_node_id, bool $a_is_portfolio=false)
+ Here is the call graph for this function:

◆ _getCommands()

static ilObjBlogAccess::_getCommands ( )
static

Definition at line 40 of file class.ilObjBlogAccess.php.

Referenced by ilObjBlogListGUI\init().

40  : array
41  {
42  return array(
43  array("permission" => "read", "cmd" => "preview", "lang_var" => "show", "default" => true),
44  array("permission" => "write", "cmd" => "render", "lang_var" => "edit"),
45  array("permission" => "contribute", "cmd" => "render", "lang_var" => "edit"),
46  array("permission" => "write", "cmd" => "edit", "lang_var" => "settings"),
47  array("permission" => "write", "cmd" => "export", "lang_var" => "export_html")
48  );
49  }
+ Here is the caller graph for this function:

◆ canBeDelivered()

ilObjBlogAccess::canBeDelivered ( ilWACPath  $ilWACPath)

Implements ilWACCheckingClass.

Definition at line 75 of file class.ilObjBlogAccess.php.

References $access, $ref_id, $results, $user, ilObject\_getAllReferences(), ilWACPath\getPath(), and ILIAS\Repository\int().

75  : bool
76  {
77  $ilUser = $this->user;
78  $ilAccess = $this->access;
79  if (preg_match("/\\/blog_([\\d]*)\\//uim", $ilWACPath->getPath(), $results)) {
80  $obj_id = $results[1];
81  if ($obj_id == "") {
82  return false;
83  }
84 
85  // personal workspace
86  $tree = new ilWorkspaceTree(0);
87  $node_id = $tree->lookupNodeId((int) $obj_id);
88  if ($node_id) {
89  $access_handler = new ilWorkspaceAccessHandler($tree);
90  if ($access_handler->checkAccessOfUser($tree, $ilUser->getId(), "read", "view", $node_id, "blog")) {
91  return true;
92  }
93  } // repository (RBAC)
94  else {
95  $ref_ids = ilObject::_getAllReferences((int) $obj_id);
96  foreach ($ref_ids as $ref_id) {
97  if ($ilAccess->checkAccessOfUser(
98  $ilUser->getId(),
99  "read",
100  "view",
101  $ref_id,
102  "blog",
103  (int) $obj_id
104  )) {
105  return true;
106  }
107  }
108  }
109  }
110 
111  return false;
112  }
ilAccessHandler $access
static _getAllReferences(int $id)
get all reference ids for object ID
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$ref_id
Definition: ltiauth.php:65
$results
+ Here is the call graph for this function:

◆ isCommentsExportPossible()

static ilObjBlogAccess::isCommentsExportPossible ( int  $blog_id)
static

Definition at line 114 of file class.ilObjBlogAccess.php.

References $DIC, and ilPrivacySettings\getInstance().

Referenced by ilObjBlogListGUI\insertCommand(), and ilBlogExportOptionHTMLWithComments\isObjectSupported().

114  : bool
115  {
116  global $DIC;
117 
118  $setting = $DIC->settings();
119  $notes = $DIC->notes();
120  $privacy = ilPrivacySettings::getInstance();
121  if ($setting->get("disable_comments")) {
122  return false;
123  }
124  if (!$privacy->enabledCommentsExport()) {
125  return false;
126  }
127  if (!$notes->domain()->commentsActive($blog_id)) {
128  return false;
129  }
130  return true;
131  }
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $access

ilAccessHandler ilObjBlogAccess::$access
protected

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

Referenced by canBeDelivered().

◆ $lng

ilLanguage ilObjBlogAccess::$lng
protected

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

◆ $user

ilObjUser ilObjBlogAccess::$user
protected

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

Referenced by canBeDelivered().


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