Skip to content
Snippets Groups Projects
Commit b4970cb1 authored by Jan-Hendrik Willms's avatar Jan-Hendrik Willms
Browse files

find only visible courses if not at least admin, fixes #3046

Closes #3046

Merge request studip/studip!2091
parent bcf449c0
No related branches found
No related tags found
No related merge requests found
...@@ -146,6 +146,10 @@ class RangeTreeNode extends SimpleORMap implements StudipTreeNode ...@@ -146,6 +146,10 @@ class RangeTreeNode extends SimpleORMap implements StudipTreeNode
$parameters = ['ids' => $with_children ? $this->getDescendantIds() : [$this->id]]; $parameters = ['ids' => $with_children ? $this->getDescendantIds() : [$this->id]];
} }
if (!$GLOBALS['perm']->have_perm(Config::get()->SEM_VISIBILITY_PERM)) {
$query .= " AND s.`visible` = 1";
}
if ($semclass !== 0) { if ($semclass !== 0) {
$query .= " AND s.`status` IN (:types)"; $query .= " AND s.`status` IN (:types)";
$parameters['types'] = array_map( $parameters['types'] = array_map(
...@@ -200,6 +204,10 @@ class RangeTreeNode extends SimpleORMap implements StudipTreeNode ...@@ -200,6 +204,10 @@ class RangeTreeNode extends SimpleORMap implements StudipTreeNode
$parameters = ['ids' => $with_children ? $this->getDescendantIds() : [$this->id]]; $parameters = ['ids' => $with_children ? $this->getDescendantIds() : [$this->id]];
} }
if (!$GLOBALS['perm']->have_perm(Config::get()->SEM_VISIBILITY_PERM)) {
$query .= " AND s.`visible` = 1";
}
if ($searchterm) { if ($searchterm) {
$query .= " AND s.`Name` LIKE :searchterm"; $query .= " AND s.`Name` LIKE :searchterm";
$parameters['searchterm'] = '%' . trim($searchterm) . '%'; $parameters['searchterm'] = '%' . trim($searchterm) . '%';
......
...@@ -498,6 +498,10 @@ class StudipStudyArea extends SimpleORMap implements StudipTreeNode ...@@ -498,6 +498,10 @@ class StudipStudyArea extends SimpleORMap implements StudipTreeNode
$parameters = ['ids' => $with_children ? $this->getDescendantIds() : [$this->id]]; $parameters = ['ids' => $with_children ? $this->getDescendantIds() : [$this->id]];
} }
if (!$GLOBALS['perm']->have_perm(Config::get()->SEM_VISIBILITY_PERM)) {
$query .= " AND s.`visible` = 1";
}
if ($semclass !== 0) { if ($semclass !== 0) {
$query .= " AND s.`status` IN (:types)"; $query .= " AND s.`status` IN (:types)";
$parameters['types'] = array_map( $parameters['types'] = array_map(
...@@ -544,6 +548,10 @@ class StudipStudyArea extends SimpleORMap implements StudipTreeNode ...@@ -544,6 +548,10 @@ class StudipStudyArea extends SimpleORMap implements StudipTreeNode
$parameters = ['ids' => $with_children ? $this->getDescendantIds() : [$this->id]]; $parameters = ['ids' => $with_children ? $this->getDescendantIds() : [$this->id]];
} }
if (!$GLOBALS['perm']->have_perm(Config::get()->SEM_VISIBILITY_PERM)) {
$query .= " AND s.`visible` = 1";
}
if ($semclass !== 0) { if ($semclass !== 0) {
$query .= " AND s.`status` IN (:types)"; $query .= " AND s.`status` IN (:types)";
$parameters['types'] = array_map( $parameters['types'] = array_map(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment