ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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");
6require_once('./Modules/Bibliographic/classes/class.ilObjBibliographicGUI.php');
7
16
29 public static function _getCommands() {
30 $commands = array
31 (
32 array( "permission" => "read", "cmd" => "render", "lang_var" => "show", "default" => true ),
33 array( "permission" => "write", "cmd" => "view", "lang_var" => "edit_content" ),
34 array( "permission" => "write", "cmd" => "edit", "lang_var" => "settings" )
35 );
36
37 return $commands;
38 }
39
40
46 public static function _checkGoto($a_target) {
47 global $DIC;
48 $ilAccess = $DIC['ilAccess'];
49 $lng = $DIC['lng'];
50 $t_arr = explode('_', $a_target);
51 if ($t_arr[0] != 'bibl' || ((int)$t_arr[1]) <= 0) {
52 return false;
53 }
54 if ($ilAccess->checkAccess('read', '', $t_arr[1])) {
55 return true;
56 }
57
58 return false;
59 }
60
61
74 public function _checkAccess($a_cmd, $a_permission, $a_ref_id, $a_obj_id, $a_user_id = "") {
75 global $DIC;
76 $ilUser = $DIC['ilUser'];
77 $lng = $DIC['lng'];
78 $rbacsystem = $DIC['rbacsystem'];
79 $ilAccess = $DIC['ilAccess'];
80 if ($a_user_id == "") {
81 $a_user_id = $ilUser->getId();
82 }
83
85 if (!self::checkEntryIdMatch($a_obj_id, $_GET[ilObjBibliographicGUI::P_ENTRY_ID])) {
86 return false;
87 }
88 }
89
90 switch ($a_cmd) {
91 case "view":
92 if (! self::_lookupOnline($a_obj_id)
93 && ! $rbacsystem->checkAccessOfUser($a_user_id, 'write', $a_ref_id)
94 ) {
95 $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
96
97 return false;
98 }
99 break;
100 // for permission query feature
101 case "infoScreen":
102 if (! self::_lookupOnline($a_obj_id)) {
103 $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
104 } else {
105 $ilAccess->addInfoItem(IL_STATUS_MESSAGE, $lng->txt("online"));
106 }
107 break;
108 }
109 switch ($a_permission) {
110 case "read":
111 case "visible":
112 if (! self::_lookupOnline($a_obj_id)
113 && (! $rbacsystem->checkAccessOfUser($a_user_id, 'write', $a_ref_id))
114 ) {
115 $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
116
117 return false;
118 }
119 break;
120 }
121
122 return true;
123 }
124
125
132 private static function checkEntryIdMatch($obj_id, $entry_id) {
133 return ilBibliographicEntry::exists($entry_id, $obj_id);
134 }
135
136
142 public static function _lookupOnline($a_id) {
143 global $DIC;
144 $ilDB = $DIC['ilDB'];
145 $q = "SELECT is_online FROM il_bibl_data WHERE id = " .
146 $ilDB->quote($a_id, "integer");
147 $bibl_set = $ilDB->query($q);
148 $bibl_rec = $ilDB->fetchAssoc($bibl_set);
149
150 return $bibl_rec["is_online"];
151 }
152}
153
154?>
$_GET["client_id"]
An exception for terminatinating execution or to throw for unit testing.
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 checkEntryIdMatch($obj_id, $entry_id)
static _lookupOnline($a_id)
Check wether bibliographic is online or not.
Class ilObjectAccess.
global $lng
Definition: privfeed.php:17
global $ilDB
global $DIC
$ilUser
Definition: imgupload.php:18