Skip to content

Commit 2f00d6c

Browse files
Merge pull request #16 from trendyminds/1.3.1
1.3.1
2 parents a9d68ba + 5829e3d commit 2f00d6c

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

CHANGELOG.md

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

3+
## 1.3.1 - 2020-06-10
4+
5+
### Fixed
6+
- Don't run Isolate event when a user is not signed in or it is invoked via console commands/migrations
7+
38
## 1.3.0 - 2020-06-09
49

510
### Changed

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.3.0",
5+
"version": "1.3.1",
66
"keywords": [
77
"permissions",
88
"entry permission",

src/Isolate.php

+10
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,16 @@ function(RegisterUserPermissionsEvent $event) {
119119
Entry::class,
120120
Entry::EVENT_AFTER_SAVE,
121121
function (ModelEvent $event) {
122+
// Don't do anything if this is a console request
123+
if (Craft::$app->getRequest()->isConsoleRequest) {
124+
return false;
125+
}
126+
127+
// Don't do anything if the user is not signed in
128+
if (Craft::$app->getUser()->isGuest) {
129+
return false;
130+
}
131+
122132
// If the user isn't isolated
123133
if (!Isolate::$plugin->isolateService->isUserIsolated(Craft::$app->getUser()->id)) {
124134
return false;

0 commit comments

Comments
 (0)