Skip to content

Commit 9f2865a

Browse files
Fix issue where structure-based queries return all entries on the site (#55)
1 parent 10885d2 commit 9f2865a

File tree

5 files changed

+10
-32
lines changed

5 files changed

+10
-32
lines changed

CHANGELOG.md

+8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Release Notes for Isolate
22

3+
## 1.5.0 - 2022-11-10
4+
5+
### Fixed
6+
- Fixes an issue where structure-based queries return all entries on the site
7+
8+
### Changed
9+
- Remove `getStructureEntries()` and make all queries through `getAllEntries()`.
10+
311
## 1.4.4 - 2021-11-10
412

513
### Fixed

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "trendyminds/isolate",
33
"description": "Restrict your Craft CMS users on a per-entry basis",
44
"type": "craft-plugin",
5-
"version": "1.4.4",
5+
"version": "1.5.0",
66
"keywords": [
77
"permissions",
88
"entry permission",

src/services/IsolateService.php

-21
Original file line numberDiff line numberDiff line change
@@ -142,27 +142,6 @@ public function isStructure(int $sectionId)
142142
return $section->type === Section::TYPE_STRUCTURE;
143143
}
144144

145-
/**
146-
* Returns all entries contained in a structure
147-
*
148-
* @param int $sectionId
149-
* @return mixed
150-
*/
151-
public function getStructureEntries(int $sectionId)
152-
{
153-
/** @var Sections $sections */
154-
$sections = Craft::$app->getSections();
155-
$section = $sections->getSectionById($sectionId);
156-
157-
/** @var Structures $structures */
158-
$structures = Craft::$app->getStructures();
159-
$structure = $structures->getStructureById($section->structureId);
160-
161-
return $this->groupEntries(
162-
Entry::findAll([ "structureId" => $structure->id, "status" => null ])
163-
);
164-
}
165-
166145
/**
167146
* Groups entries with the same ID (multi-site setup)
168147
*

src/templates/users/_user.twig

+1-5
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,7 @@
5050
{% set isolatedEntries = isolatedEntries | merge([record.entryId]) %}
5151
{% endfor %}
5252

53-
{% if isStructure %}
54-
{% set entries = craft.isolate.getStructureEntries(section.id) %}
55-
{% else %}
56-
{% set entries = craft.isolate.getAllEntries(section.id) %}
57-
{% endif %}
53+
{% set entries = craft.isolate.getAllEntries(section.id) %}
5854

5955
<input type="hidden" name="action" value="isolate/users/save">
6056
<input type="hidden" name="userId" value="{{user.id}}">

src/variables/IsolateVariable.php

-5
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,4 @@ public function isStructure(int $sectionId)
5252
{
5353
return Isolate::$plugin->isolateService->isStructure($sectionId);
5454
}
55-
56-
public function getStructureEntries(int $sectionId)
57-
{
58-
return Isolate::$plugin->isolateService->getStructureEntries($sectionId);
59-
}
6055
}

0 commit comments

Comments
 (0)