ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilObjLinkResourceAccess Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilObjLinkResourceAccess:
+ Collaboration diagram for ilObjLinkResourceAccess:

Public Member Functions

 _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 _getFirstLink (int $a_webr_id)
 Get first link item Check before with _isSingular() if there is more or less than one. More...
 
static _preloadData (array $obj_ids, array $ref_ids)
 
static _checkDirectLink ($a_obj_id)
 Check whether there is only one active link in the web resource. More...
 
- 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...
 

Static Public Attributes

static array $item = []
 
static array $single_link = []
 

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 Class ilObjLinkResourceAccess

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

Definition at line 25 of file class.ilObjLinkResourceAccess.php.

Member Function Documentation

◆ _checkAccess()

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

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

References $DIC.

79  : bool {
80  global $DIC;
81  $rbacsystem = $DIC->rbac()->system();
82  $web_link_repo = new ilWebLinkDatabaseRepository($obj_id);
83 
84  // Set offline if no valid link exists
85  if ($permission == 'read') {
86  if (!$web_link_repo->getAllItemsAsContainer(true)
87  ->getFirstItem() &&
88  !$rbacsystem->checkAccessOfUser(
89  $user_id,
90  'write',
91  $ref_id
92  )) {
93  return false;
94  }
95  }
96  return parent::_checkAccess(
97  $cmd,
98  $permission,
99  $ref_id,
100  $obj_id,
101  $user_id
102  );
103  }
global $DIC
Definition: feed.php:28
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$ref_id
Definition: ltiauth.php:67

◆ _checkDirectLink()

static ilObjLinkResourceAccess::_checkDirectLink (   $a_obj_id)
static

Check whether there is only one active link in the web resource.

In this case this link is shown in a new browser window

Definition at line 139 of file class.ilObjLinkResourceAccess.php.

Referenced by ilObjLinkResourceListGUI\getCommandFrame(), ilObjLinkResourceListGUI\getCommandLink(), ilObjLinkResourceListGUI\getDescription(), and ilObjLinkResourceListGUI\getTitle().

139  : bool
140  {
141  if (isset(self::$single_link[$a_obj_id])) {
142  return self::$single_link[$a_obj_id];
143  }
144 
145  $web_link_repo = new ilWebLinkDatabaseRepository($a_obj_id);
146 
147  return self::$single_link[$a_obj_id] = $web_link_repo->doesOnlyOneItemExist(true);
148  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the caller graph for this function:

◆ _checkGoto()

static ilObjLinkResourceAccess::_checkGoto ( string  $target)
static

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

References $DIC, $ref_id, $type, and ILIAS\Repository\int().

56  : bool
57  {
58  global $DIC;
59 
60  $ilAccess = $DIC->access();
61 
62  $t_arr = explode("_", $target);
63  $type = $t_arr[0] ?? '';
64  $ref_id = (int) ($t_arr[1] ?? 0);
65 
66  if ($type !== 'webr' || $ref_id <= 0) {
67  return false;
68  }
69  return $ilAccess->checkAccess('read', '', $ref_id) ||
70  $ilAccess->checkAccess('visible', '', $ref_id);
71  }
$type
global $DIC
Definition: feed.php:28
$ref_id
Definition: ltiauth.php:67
+ Here is the call graph for this function:

◆ _getCommands()

static ilObjLinkResourceAccess::_getCommands ( )
static

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

Referenced by ilObjLinkResourceListGUI\init().

33  : array
34  {
35  return array(
36  array("permission" => "read",
37  "cmd" => "",
38  "lang_var" => "show",
39  "default" => true
40  ),
41  array("permission" => "read",
42  "cmd" => "exportHTML",
43  "lang_var" => "export_html"
44  ),
45  array("permission" => "write",
46  "cmd" => "editLinks",
47  "lang_var" => "edit_content"
48  ),
49  array("permission" => "write",
50  "cmd" => "settings",
51  "lang_var" => "settings"
52  )
53  );
54  }
+ Here is the caller graph for this function:

◆ _getFirstLink()

static ilObjLinkResourceAccess::_getFirstLink ( int  $a_webr_id)
static

Get first link item Check before with _isSingular() if there is more or less than one.

Definition at line 109 of file class.ilObjLinkResourceAccess.php.

Referenced by ilObjLinkResourceGUI\callDirectLink(), ilObjLinkResource\cloneObject(), ilObjLinkResourceListGUI\getCommandFrame(), ilObjLinkResourceListGUI\getDescription(), and ilObjLinkResourceListGUI\getTitle().

109  : ilWebLinkItem
110  {
111  if (isset(self::$item[$a_webr_id])) {
112  return self::$item[$a_webr_id];
113  }
114 
115  $web_link_repo = new ilWebLinkDatabaseRepository($a_webr_id);
116 
117  $current_item = $web_link_repo->getAllItemsAsContainer(true)
118  ->getFirstItem();
119 
120  self::$item[$current_item->getWebrId()] = $current_item;
121 
122  return $current_item;
123  }
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...
+ Here is the caller graph for this function:

◆ _preloadData()

static ilObjLinkResourceAccess::_preloadData ( array  $obj_ids,
array  $ref_ids 
)
static

Definition at line 125 of file class.ilObjLinkResourceAccess.php.

References $id.

125  : void
126  {
127  foreach ($obj_ids as $id) {
128  $web_link_repo = new ilWebLinkDatabaseRepository($id);
129  $first_item = $web_link_repo->getAllItemsAsContainer(true)
130  ->getFirstItem();
131  self::$item[$id] = $first_item;
132  }
133  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

Field Documentation

◆ $item

array ilObjLinkResourceAccess::$item = []
static

Definition at line 30 of file class.ilObjLinkResourceAccess.php.

◆ $single_link

array ilObjLinkResourceAccess::$single_link = []
static

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


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