Skip to content

Commit

Permalink
Merge pull request #16 from trendyminds/1.3.1
Browse files Browse the repository at this point in the history
1.3.1
  • Loading branch information
aaronbushnell authored Jun 10, 2020
2 parents a9d68ba + 5829e3d commit 2f00d6c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Release Notes for Isolate

## 1.3.1 - 2020-06-10

### Fixed
- Don't run Isolate event when a user is not signed in or it is invoked via console commands/migrations

## 1.3.0 - 2020-06-09

### Changed
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": "1.3.0",
"version": "1.3.1",
"keywords": [
"permissions",
"entry permission",
Expand Down
10 changes: 10 additions & 0 deletions src/Isolate.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,16 @@ function(RegisterUserPermissionsEvent $event) {
Entry::class,
Entry::EVENT_AFTER_SAVE,
function (ModelEvent $event) {
// Don't do anything if this is a console request
if (Craft::$app->getRequest()->isConsoleRequest) {
return false;
}

// Don't do anything if the user is not signed in
if (Craft::$app->getUser()->isGuest) {
return false;
}

// If the user isn't isolated
if (!Isolate::$plugin->isolateService->isUserIsolated(Craft::$app->getUser()->id)) {
return false;
Expand Down

0 comments on commit 2f00d6c

Please sign in to comment.