ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules Pages
ilObjDataCollectionAccess Class Reference

Class ilObjDataCollectionAccess. More...

+ Inheritance diagram for ilObjDataCollectionAccess:
+ Collaboration diagram for ilObjDataCollectionAccess:

Public Member Functions

 _getCommands ()
 get commands More...
 
 _checkGoto ($a_target)
 check whether goto script will succeed More...
 
 _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::checkAccess) More...
 
 _lookupOnline ($a_id)
 Check wether datacollection is online. More...
 
- Public Member Functions inherited from ilObjectAccess
 _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::checkAccess) More...
 
 _checkCondition ($a_obj_id, $a_operator, $a_value, $a_usr_id)
 check condition More...
 
 _getCommands ()
 get commands More...
 
 _checkGoto ($a_target)
 check whether goto script will succeed More...
 
 _preloadData ($a_obj_ids, $a_ref_ids)
 Preload data. More...
 

Static Public Member Functions

static checkAccessForDataCollectionId ($data_collection_id)
 
static checkActionForObjId ($action, $obj_id)
 
static hasWriteAccess ($ref)
 
static hasAddRecordAccess ($ref)
 
static hasReadAccess ($ref)
 
- Static Public Member Functions inherited from ilObjectAccess
static _isOffline ($a_obj_id)
 Type-specific implementation of general status, has to be overwritten. More...
 

Detailed Description

Member Function Documentation

◆ _checkAccess()

ilObjDataCollectionAccess::_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::checkAccess)

Parameters
string$a_cmdcommand (not permission!)
string$a_permissionpermission
int$a_ref_idreference id
int$a_obj_idobject id
int$a_user_iduser id (if not provided, current user is taken)
Returns
boolean true, if everything is ok

Definition at line 74 of file class.ilObjDataCollectionAccess.php.

References $ilUser, $lng, _lookupOnline(), and IL_NO_OBJECT_ACCESS.

74  {
75  global $ilUser, $lng, $rbacsystem, $ilAccess;
76 
77  if ($a_user_id == "") {
78  $a_user_id = $ilUser->getId();
79  }
80  switch ($a_cmd) {
81  case "view":
82 
84  && ! $rbacsystem->checkAccessOfUser($a_user_id, 'write', $a_ref_id)
85  ) {
86  $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
87 
88  return false;
89  }
90  break;
91 
92  // for permission query feature
93  case "infoScreen":
95  $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
96  } else {
97  $ilAccess->addInfoItem(IL_STATUS_MESSAGE, $lng->txt("online"));
98  }
99  break;
100  }
101  switch ($a_permission) {
102  case "read":
103  case "visible":
105  && (! $rbacsystem->checkAccessOfUser($a_user_id, 'write', $a_ref_id))
106  ) {
107  $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
108 
109  return false;
110  }
111  break;
112  }
113 
114  return true;
115  }
const IL_NO_OBJECT_ACCESS
_lookupOnline($a_id)
Check wether datacollection is online.
global $ilUser
Definition: imgupload.php:15
global $lng
Definition: privfeed.php:40
+ Here is the call graph for this function:

◆ _checkGoto()

ilObjDataCollectionAccess::_checkGoto (   $a_target)

check whether goto script will succeed

Definition at line 45 of file class.ilObjDataCollectionAccess.php.

45  {
46  global $ilAccess;
47 
48  $t_arr = explode("_", $a_target);
49 
50  if ($t_arr[0] != "dcl" || ((int)$t_arr[1]) <= 0) {
51  return false;
52  }
53 
54  if ($ilAccess->checkAccess("read", "", $t_arr[1])) {
55  return true;
56  }
57 
58  return false;
59  }

◆ _getCommands()

ilObjDataCollectionAccess::_getCommands ( )

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"), );

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

Referenced by ilObjDataCollectionListGUI\init().

31  {
32  $commands = array(
33  array( "permission" => "read", "cmd" => "render", "lang_var" => "show", "default" => true ),
34  array( "permission" => "write", "cmd" => "listRecords", "lang_var" => "edit_content" ),
35  array( "permission" => "write", "cmd" => "edit", "lang_var" => "settings" )
36  );
37 
38  return $commands;
39  }
+ Here is the caller graph for this function:

◆ _lookupOnline()

ilObjDataCollectionAccess::_lookupOnline (   $a_id)

Check wether datacollection is online.

Parameters
int$a_idwiki id

Definition at line 123 of file class.ilObjDataCollectionAccess.php.

References $ilDB.

Referenced by _checkAccess(), and ilObjDataCollectionListGUI\getProperties().

123  {
124  global $ilDB;
125 
126  $q = "SELECT * FROM il_dcl_data WHERE id = " . $ilDB->quote($a_id, "integer");
127  $dcl_set = $ilDB->query($q);
128  $dcl_rec = $ilDB->fetchAssoc($dcl_set);
129 
130  return $dcl_rec["is_online"];
131  }
global $ilDB
+ Here is the caller graph for this function:

◆ checkAccessForDataCollectionId()

static ilObjDataCollectionAccess::checkAccessForDataCollectionId (   $data_collection_id)
static
Parameters
$data_collection_iduse checkActionForId instead
Returns
bool

Definition at line 143 of file class.ilObjDataCollectionAccess.php.

References ilObject2\_getAllReferences().

143  {
144  global $ilAccess;
145 
146  $perm = false;
147  $references = ilObject2::_getAllReferences($data_collection_id);
148 
149  if ($ilAccess->checkAccess("add_entry", "", array_shift($references))) {
150  $perm = true;
151  }
152 
153  return $perm;
154  }
static _getAllReferences($a_id)
+ Here is the call graph for this function:

◆ checkActionForObjId()

static ilObjDataCollectionAccess::checkActionForObjId (   $action,
  $obj_id 
)
static
Parameters
$action
$obj_id
Returns
bool

Definition at line 163 of file class.ilObjDataCollectionAccess.php.

References $ref_id, and ilObject2\_getAllReferences().

Referenced by ilDataCollectionTableEditGUI\save().

163  {
164  foreach (ilObject2::_getAllReferences($obj_id) as $ref_id) {
165  if (self::checkActionForRefId($action, $ref_id)) {
166  return true;
167  }
168  }
169 
170  return false;
171  }
static _getAllReferences($a_id)
$ref_id
Definition: sahs_server.php:39
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hasAddRecordAccess()

static ilObjDataCollectionAccess::hasAddRecordAccess (   $ref)
static
Parameters
$refint the reference id of the datacollection object to check.
Returns
bool whether or not the current user has admin/write access to the referenced datacollection

Definition at line 208 of file class.ilObjDataCollectionAccess.php.

Referenced by ilDataCollectionRecordEditGUI\executeCommand(), ilDataCollectionTable\hasPermissionToAddRecord(), ilDataCollectionTable\hasPermissionToDeleteRecord(), and ilDataCollectionTable\hasPermissionToEditRecord().

208  {
209  global $ilAccess;
210 
211  return $ilAccess->checkAccess("add_entry", "", $ref);
212  }
+ Here is the caller graph for this function:

◆ hasReadAccess()

static ilObjDataCollectionAccess::hasReadAccess (   $ref)
static
Parameters
$refint the reference id of the datacollection object to check.
Returns
bool whether or not the current user has read access to the referenced datacollection

Definition at line 220 of file class.ilObjDataCollectionAccess.php.

Referenced by ilObjDataCollection\_hasReadAccess(), and ilDataCollectionTable\hasPermissionToDeleteRecords().

220  {
221  global $ilAccess;
222 
223  return $ilAccess->checkAccess("read", "", $ref);
224  }
+ Here is the caller graph for this function:

◆ hasWriteAccess()

static ilObjDataCollectionAccess::hasWriteAccess (   $ref)
static
Parameters
$refint the reference id of the datacollection object to check.
Returns
bool whether or not the current user has admin/write access to the referenced datacollection

Definition at line 196 of file class.ilObjDataCollectionAccess.php.

Referenced by ilObjDataCollection\_hasWriteAccess(), ilDataCollectionRecordViewGUI\doExtReplace(), ilDataCollectionTable\getPartialRecords(), ilDataCollectionTable\hasPermissionToAddRecord(), ilDataCollectionTable\hasPermissionToAddTable(), ilDataCollectionTable\hasPermissionToDeleteRecord(), ilDataCollectionTable\hasPermissionToDeleteRecords(), ilDataCollectionTable\hasPermissionToEditRecord(), ilDataCollectionTable\hasPermissionToFields(), and ilDataCollectionRecordEditGUI\save().

196  {
197  global $ilAccess;
198 
199  return $ilAccess->checkAccess("write", "", $ref);
200  }
+ Here is the caller graph for this function:

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