Skip to content

Commit

Permalink
Merge branch 'craft-4' of github.com:trendyminds/isolate into craft-4
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronbushnell committed Jan 1, 2024
2 parents bd1327b + 01cee40 commit 5904287
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 32 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Release Notes for Isolate

## 2.1.0 - 2022-11-10

### Fixed
- Fixes an issue where structure-based queries return all entries on the site

### Changed
- Remove `getStructureEntries()` and make all queries through `getAllEntries()`.

## 2.0.0 - 2022-07-05

### Added
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "trendyminds/isolate",
"description": "Restrict your Craft CMS users on a per-entry basis",
"type": "craft-plugin",
"version": "2.0.0",
"version": "2.1.0",
"keywords": [
"permissions",
"entry permission",
Expand Down
21 changes: 0 additions & 21 deletions src/services/IsolateService.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,27 +142,6 @@ public function isStructure(int $sectionId)
return $section->type === Section::TYPE_STRUCTURE;
}

/**
* Returns all entries contained in a structure
*
* @param int $sectionId
* @return mixed
*/
public function getStructureEntries(int $sectionId)
{
/** @var Sections $sections */
$sections = Craft::$app->getSections();
$section = $sections->getSectionById($sectionId);

/** @var Structures $structures */
$structures = Craft::$app->getStructures();
$structure = $structures->getStructureById($section->structureId);

return $this->groupEntries(
Entry::findAll([ "structureId" => $structure->id, "status" => null ])
);
}

/**
* Groups entries with the same ID (multi-site setup)
*
Expand Down
6 changes: 1 addition & 5 deletions src/templates/users/_user.twig
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,7 @@
{% set isolatedEntries = isolatedEntries | merge([record.entryId]) %}
{% endfor %}

{% if isStructure %}
{% set entries = craft.isolate.getStructureEntries(section.id) %}
{% else %}
{% set entries = craft.isolate.getAllEntries(section.id) %}
{% endif %}
{% set entries = craft.isolate.getAllEntries(section.id) %}

<input type="hidden" name="action" value="isolate/users/save">
<input type="hidden" name="userId" value="{{user.id}}">
Expand Down
5 changes: 0 additions & 5 deletions src/variables/IsolateVariable.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,4 @@ public function isStructure(int $sectionId)
{
return Isolate::$plugin->isolateService->isStructure($sectionId);
}

public function getStructureEntries(int $sectionId)
{
return Isolate::$plugin->isolateService->getStructureEntries($sectionId);
}
}

0 comments on commit 5904287

Please sign in to comment.