Skip to content

Commit

Permalink
Commented out checks for current user id (do this properly at a later…
Browse files Browse the repository at this point in the history
… time).
  • Loading branch information
arnemorken committed Dec 10, 2024
1 parent abecdfb commit bf53de2
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions data/mysql/anyTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -735,9 +735,9 @@ protected function findItemLeftJoin($includeUser)
$user_id = ltrim(Parameters::get($this->mIdKey));
$lj .= "LEFT JOIN ".$this->mTableNameUserLink." ".
"ON " .$this->mTableNameUserLink.".".$this->mIdKeyTable."='".$user_id."' ";
$cur_uid = $this->mPermission["current_user_id"];
if ($cur_uid || $cur_uid === 0)
$lj .= "AND ".$this->mTableNameUserLink.".user_id='".$cur_uid."' ";
//$cur_uid = $this->mPermission["current_user_id"];
//if ($cur_uid || $cur_uid === 0)
// $lj .= "AND ".$this->mTableNameUserLink.".user_id='".$cur_uid."' ";
}

// Get parent name
Expand Down Expand Up @@ -1091,7 +1091,7 @@ protected function findListSelect($groupId,$linkType=null,$linkId=null,$grouping

protected function findListLeftJoin($groupId,$linkType=null,$linkId=null,$grouping=true,$linktable_name="",$has_linktable=false)
{
$cur_uid = $this->mPermission["current_user_id"];
//$cur_uid = $this->mPermission["current_user_id"];
$lj = "";

// Left join own table to get parent name
Expand All @@ -1100,18 +1100,18 @@ protected function findListLeftJoin($groupId,$linkType=null,$linkId=null,$groupi

// Left join link table
if (($linkId || $linkId === 0) && isset($linkType) && $linkType != "" && $linkType != $this->mType)
$lj .= $this->findListLeftJoinOne($cur_uid,$groupId,$linkType,$linkId,$grouping,$linktable_name,$has_linktable);
$lj .= $this->findListLeftJoinOne(/*$cur_uid,*/$groupId,$linkType,$linkId,$grouping,$linktable_name,$has_linktable);

// Left join group table
if ($grouping && $this->mType != "group" && isset($this->mGroupTable)) {
$linktable_name_grp = $this->findLinkTableName("group");
$has_linktable_grp = $this->tableExists($linktable_name_grp);
$lj .= $this->findListLeftJoinOne($cur_uid,$groupId,"group",$linkId,$grouping,$linktable_name_grp,$has_linktable_grp);
$lj .= $this->findListLeftJoinOne(/*$cur_uid,*/$groupId,"group",$linkId,$grouping,$linktable_name_grp,$has_linktable_grp);
}
return $lj;
} // findListLeftJoin

protected function findListLeftJoinOne($cur_uid,$groupId,$linkType=null,$linkId=null,$grouping=true,$linktable_name="",$has_linktable=false)
protected function findListLeftJoinOne(/*$cur_uid,*/$groupId,$linkType=null,$linkId=null,$grouping=true,$linktable_name="",$has_linktable=false)
{
$typetable_name = $this->findTypeTableName($linkType);
$typetable_id = $this->findTypeTableId($linkType);
Expand All @@ -1127,8 +1127,8 @@ protected function findListLeftJoinOne($cur_uid,$groupId,$linkType=null,$linkId=
$lj .= "OR ".$linktable_name.".".$this->mIdKeyTable."=tmp.".$this->mIdKeyTable." ";

// Only return results for current user:
if (!isset($linkType) || $linkType == "user" && $cur_uid)
$lj .= "AND CAST(".$linktable_name.".".$linktable_id." AS INT)=CAST(".$cur_uid." AS INT) ";
//if (!isset($linkType) || $linkType == "user" && $cur_uid)
// $lj .= "AND CAST(".$linktable_name.".".$linktable_id." AS INT)=CAST(".$cur_uid." AS INT) ";

if ($has_typetable) {
if ($linkType != "group")
Expand Down

0 comments on commit bf53de2

Please sign in to comment.