Skip to content

Commit

Permalink
getInstanceData() return empty array if no persmission
Browse files Browse the repository at this point in the history
  • Loading branch information
lsgs committed Mar 19, 2023
1 parent c340625 commit 2a4fb3f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions InstanceTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,8 @@ public function getInstanceData($record, $event, $form, $fields, $filter, $inclu
$filter = str_replace(self::REPLQUOTE_SINGLE,"'",str_replace(self::REPLQUOTE_DOUBLE,'"',$filter));

## Check user permissions for access to form with instance table or form with data

if ($this->isSurvey) return array(); // ajax calls from surveys not allowed

This comment has been minimized.

Copy link
@jgardner-qha

jgardner-qha May 4, 2023

I'm not understanding the purpose of this line, but it prevents the table from working on a survey page. Commenting this line out restores previous functionality.


// find any descriptive text fields tagged with @FORMINSTANCETABLE=form_name
$this->setTaggedFields();
$this->checkUserPermissions();
Expand All @@ -402,14 +403,14 @@ public function getInstanceData($record, $event, $form, $fields, $filter, $inclu
$hasPermissions = true;
}
}
$recordDag = $this->getDAG($record);
if(!empty($this->user_rights["group_id"]) && $this->user_rights["group_id"] != $recordDag) {
$hasPermissions = false;
}

if(!$hasPermissions) {
return false;
if(!$hasPermissions) {
return array();
}

$repeatingFormFields = REDCap::getDataDictionary('array', false, null, $form);
Expand Down

0 comments on commit 2a4fb3f

Please sign in to comment.