ILIAS  release_8 Revision v8.24
ilObjMediaCastAccess 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 ilObjMediaCastAccess:
+ Collaboration diagram for ilObjMediaCastAccess:

Public Member Functions

 __construct ()
 
 _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...
 
- 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)
 
 canBeDelivered (ilWACPath $ilWACPath)
 

Static Public Member Functions

static _getCommands ()
 get commands More...
 
static _checkGoto (string $target)
 check whether goto script will succeed More...
 
static _lookupOnline (int $a_id)
 
static _lookupPublicFiles (int $a_id)
 
static _lookupDiskUsage (int $a_id)
 Returns the number of bytes used on the harddisk by the file object with the specified object id. 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...
 

Protected Attributes

ilObjUser $user
 
ilLanguage $lng
 
ilRbacSystem $rbacsystem
 
ilAccessHandler $access
 

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

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

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

Constructor & Destructor Documentation

◆ __construct()

ilObjMediaCastAccess::__construct ( )

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

30 {
31 global $DIC;
32
33 $this->user = $DIC->user();
34 $this->lng = $DIC->language();
35 $this->rbacsystem = $DIC->rbac()->system();
36 $this->access = $DIC->access();
37 }
global $DIC
Definition: feed.php:28

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

+ Here is the call graph for this function:

Member Function Documentation

◆ _checkAccess()

ilObjMediaCastAccess::_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)

Please do not check any preconditions handled by ilConditionHandler here. Also don't do any RBAC checks.

Reimplemented from ilObjectAccess.

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

51 : bool
52 {
56 $ilAccess = $this->access;
57
58 if (is_null($user_id)) {
59 $user_id = $ilUser->getId();
60 }
61
62 switch ($cmd) {
63 case "listItems":
64
66 && !$rbacsystem->checkAccessOfUser($user_id, 'write', $ref_id)) {
67 $ilAccess->addInfoItem(ilAccessInfo::IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
68 return false;
69 }
70 break;
71
72 // for permission query feature
73 case "infoScreen":
75 $ilAccess->addInfoItem(ilAccessInfo::IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
76 } else {
77 $ilAccess->addInfoItem(ilAccessInfo::IL_STATUS_MESSAGE, $lng->txt("online"));
78 }
79 break;
80
81 }
82 switch ($permission) {
83 case "read":
84 case "visible":
86 (!$rbacsystem->checkAccessOfUser($user_id, 'write', $ref_id))) {
87 $ilAccess->addInfoItem(ilAccessInfo::IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
88 return false;
89 }
90 break;
91 }
92
93 return true;
94 }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
checkAccessOfUser(int $a_user_id, string $a_operations, int $a_ref_id, string $a_type="")
$ilUser
Definition: imgupload.php:34
$ref_id
Definition: ltiauth.php:67

References $access, $ilUser, $lng, $rbacsystem, $ref_id, $user, _lookupOnline(), ilRbacSystem\checkAccessOfUser(), ilAccessInfo\IL_NO_OBJECT_ACCESS, ilAccessInfo\IL_STATUS_MESSAGE, and ilLanguage\txt().

+ Here is the call graph for this function:

◆ _checkGoto()

static ilObjMediaCastAccess::_checkGoto ( string  $target)
static

check whether goto script will succeed

Reimplemented from ilObjectAccess.

Definition at line 96 of file class.ilObjMediaCastAccess.php.

96 : bool
97 {
98 global $DIC;
99
100 $ilAccess = $DIC->access();
101
102 $t_arr = explode("_", $target);
103
104 if ($t_arr[0] != "mcst" || ((int) $t_arr[1]) <= 0) {
105 return false;
106 }
107
108 if ($ilAccess->checkAccess("read", "", $t_arr[1]) ||
109 $ilAccess->checkAccess("visible", "", $t_arr[1])) {
110 return true;
111 }
112 return false;
113 }

References $DIC.

◆ _getCommands()

static ilObjMediaCastAccess::_getCommands ( )
static

get commands

this method returns an array of all possible commands/permission combinations

example: $commands = array ( array("permission" => "read", "cmd" => "view", "lang_var" => "show"), array("permission" => "write", "cmd" => "edit", "lang_var" => "edit"), );

Returns
array{permission?:string, cmd?:string, lang_var?:string, default?:bool}[]

Reimplemented from ilObjectAccess.

Definition at line 39 of file class.ilObjMediaCastAccess.php.

39 : array
40 {
41 $commands = array(
42 array("permission" => "read", "cmd" => "showContent", "lang_var" => "show",
43 "default" => true),
44 array("permission" => "write", "cmd" => "listItems", "lang_var" => "edit_content"),
45 array("permission" => "write", "cmd" => "editSettings", "lang_var" => "settings")
46 );
47
48 return $commands;
49 }

Referenced by ilObjMediaCastListGUI\init().

+ Here is the caller graph for this function:

◆ _lookupDiskUsage()

static ilObjMediaCastAccess::_lookupDiskUsage ( int  $a_id)
static

Returns the number of bytes used on the harddisk by the file object with the specified object id.

Definition at line 145 of file class.ilObjMediaCastAccess.php.

145 : int
146 {
147 $obj = new ilObjMediaCast($a_id, false);
148 $obj->read();
149 $items = $obj->getItemsArray();
150 $size = 0;
151 foreach ($items as $item) {
152 $news_item = new ilNewsItem($item["id"]);
153 $news_item->read();
154 $mobId = $news_item->getMobId();
156 }
157 return $size;
158 }
static dirsize(string $directory)
get size of a directory or a file.
A news item can be created by different sources.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getDirectory(int $a_mob_id)
Get absolute directory.

References ilObjMediaObject\_getDirectory(), and ilFileUtils\dirsize().

+ Here is the call graph for this function:

◆ _lookupOnline()

static ilObjMediaCastAccess::_lookupOnline ( int  $a_id)
static

Definition at line 115 of file class.ilObjMediaCastAccess.php.

115 : bool
116 {
117 global $DIC;
118
119 $ilDB = $DIC->database();
120
121 $q = "SELECT * FROM il_media_cast_data WHERE id = " . $ilDB->quote($a_id);
122 $mc_set = $ilDB->query($q);
123 $mc_rec = $mc_set->fetchRow(ilDBConstants::FETCHMODE_ASSOC);
124
125 return (bool) ($mc_rec["is_online"] ?? false);
126 }

References $DIC, $ilDB, and ilDBConstants\FETCHMODE_ASSOC.

Referenced by ilObjectFeedWriter\__construct(), ilUserFeedWriter\__construct(), _checkAccess(), ilObjMediaCastListGUI\getProperties(), and ilContainer\legacyOnlineFilter().

+ Here is the caller graph for this function:

◆ _lookupPublicFiles()

static ilObjMediaCastAccess::_lookupPublicFiles ( int  $a_id)
static

Definition at line 128 of file class.ilObjMediaCastAccess.php.

128 : bool
129 {
130 global $DIC;
131
132 $ilDB = $DIC->database();
133
134 $q = "SELECT * FROM il_media_cast_data WHERE id = " . $ilDB->quote($a_id);
135 $mc_set = $ilDB->query($q);
136 $mc_rec = $mc_set->fetchRow(ilDBConstants::FETCHMODE_ASSOC);
137
138 return (bool) $mc_rec["public_files"];
139 }

References $DIC, $ilDB, and ilDBConstants\FETCHMODE_ASSOC.

Referenced by ilObjectFeedWriter\__construct().

+ Here is the caller graph for this function:

Field Documentation

◆ $access

ilAccessHandler ilObjMediaCastAccess::$access
protected

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

Referenced by _checkAccess().

◆ $lng

ilLanguage ilObjMediaCastAccess::$lng
protected

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

Referenced by _checkAccess().

◆ $rbacsystem

ilRbacSystem ilObjMediaCastAccess::$rbacsystem
protected

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

Referenced by _checkAccess().

◆ $user

ilObjUser ilObjMediaCastAccess::$user
protected

Definition at line 24 of file class.ilObjMediaCastAccess.php.

Referenced by _checkAccess().


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