ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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: shib_login.php:26

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 {
53 $ilUser = $this->user;
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
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 switch ($permission) {
82 case "read":
83 case "visible":
84 if (self::_isOffline($obj_id) &&
86 $ilAccess->addInfoItem(ilAccessInfo::IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
87 return false;
88 }
89 break;
90 }
91
92 return true;
93 }
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="")
$ref_id
Definition: ltiauth.php:66

References $access, $lng, $rbacsystem, $ref_id, $user, $user_id, _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 95 of file class.ilObjMediaCastAccess.php.

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

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 144 of file class.ilObjMediaCastAccess.php.

144 : int
145 {
146 $obj = new ilObjMediaCast($a_id, false);
147 $obj->read();
148 $items = $obj->getItemsArray();
149 $size = 0;
150 foreach ($items as $item) {
151 $news_item = new ilNewsItem($item["id"]);
152 $news_item->read();
153 $mobId = $news_item->getMobId();
155 }
156 return $size;
157 }
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 114 of file class.ilObjMediaCastAccess.php.

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

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

Referenced by ilObjectFeedWriter\__construct(), ilUserFeedWriter\__construct(), _checkAccess(), and ILIAS\Container\Content\Filter\FilterManager\legacyOnlineFilter().

+ Here is the caller graph for this function:

◆ _lookupPublicFiles()

static ilObjMediaCastAccess::_lookupPublicFiles ( int  $a_id)
static

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

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

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

Referenced by ilObjectFeedWriter\__construct(), and ilMobStakeholder\checkAccessMobUsage().

+ 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: