ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilObjBibliographicAccess.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
4
5include_once("./Services/Object/classes/class.ilObjectAccess.php");
6
15
28 public function _getCommands() {
29 $commands = array
30 (
31 array( "permission" => "read", "cmd" => "render", "lang_var" => "show", "default" => true ),
32 array( "permission" => "write", "cmd" => "view", "lang_var" => "edit_content" ),
33 array( "permission" => "write", "cmd" => "edit", "lang_var" => "settings" )
34 );
35
36 return $commands;
37 }
38
39
45 public function _checkGoto($a_target) {
46 global $ilAccess, $lng;
47 $t_arr = explode('_', $a_target);
48 if ($t_arr[0] != 'bibl' || ((int)$t_arr[1]) <= 0) {
49 return false;
50 }
51 if ($ilAccess->checkAccess('read', '', $t_arr[1])) {
52 return true;
53 }
54
55 return false;
56 }
57
58
71 public function _checkAccess($a_cmd, $a_permission, $a_ref_id, $a_obj_id, $a_user_id = "") {
72 global $ilUser, $lng, $rbacsystem, $ilAccess;
73 if ($a_user_id == "") {
74 $a_user_id = $ilUser->getId();
75 }
76 switch ($a_cmd) {
77 case "view":
78 if (! self::_lookupOnline($a_obj_id)
79 && ! $rbacsystem->checkAccessOfUser($a_user_id, 'write', $a_ref_id)
80 ) {
81 $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
82
83 return false;
84 }
85 break;
86 // for permission query feature
87 case "infoScreen":
88 if (! self::_lookupOnline($a_obj_id)) {
89 $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
90 } else {
91 $ilAccess->addInfoItem(IL_STATUS_MESSAGE, $lng->txt("online"));
92 }
93 break;
94 }
95 switch ($a_permission) {
96 case "read":
97 case "visible":
98 if (! self::_lookupOnline($a_obj_id)
99 && (! $rbacsystem->checkAccessOfUser($a_user_id, 'write', $a_ref_id))
100 ) {
101 $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
102
103 return false;
104 }
105 break;
106 }
107
108 return true;
109 }
110
111
117 public static function _lookupOnline($a_id) {
118 global $ilDB;
119 $q = "SELECT is_online FROM il_bibl_data WHERE id = " .
120 $ilDB->quote($a_id, "integer");
121 $bibl_set = $ilDB->query($q);
122 $bibl_rec = $ilDB->fetchAssoc($bibl_set);
123
124 return $bibl_rec["is_online"];
125 }
126}
127
128?>
const IL_NO_OBJECT_ACCESS
Class ilObjBibliographicAccess.
_checkAccess($a_cmd, $a_permission, $a_ref_id, $a_obj_id, $a_user_id="")
checks wether a user may invoke a command or not (this method is called by ilAccessHandler::checkAcce...
static _lookupOnline($a_id)
Check wether bibliographic is online or not.
Class ilObjectAccess.
global $lng
Definition: privfeed.php:40
global $ilDB
global $ilUser
Definition: imgupload.php:15