Skip to content

Commit

Permalink
Merge pull request #174 from boboldehampsink/assign-user-group-fix
Browse files Browse the repository at this point in the history
Fixed "assign user group" permissions not being exported
  • Loading branch information
bvangennep authored Jan 10, 2019
2 parents a12e21b + 43220ab commit eb77d97
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 1 deletion.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ php:
- 7.0
- 7.1
- 7.2
- 7.3
# aliased to a recent hhvm version
- hhvm

Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 4.1.1 - 2019-01-08
### Fixed
- Fixed "assign user group" permissions not being exported
- Fixed issue where global set sources weren't linked because they were cached

## 4.1.0 - 2018-11-19
### Added
- Added more flexibility for getting a record's index
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "4.1.0",
"version": "4.1.1",
"name": "nerds-and-company/schematic",
"description": "Craft setup and sync tool",
"type": "craft-plugin",
Expand Down
4 changes: 4 additions & 0 deletions src/Behaviors/SourcesBehavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@ public function getSource(string $fieldType, string $source = null, string $inde
$service = Craft::$app->sections;
$method = 'getSectionBy';
break;
case 'assignUserGroup':
$service = Craft::$app->userGroups;
$method = 'getGroupBy';
break;
case 'group':
case 'editCategories':
$service = Users::class == $fieldType ? Craft::$app->userGroups : Craft::$app->categories;
Expand Down
14 changes: 14 additions & 0 deletions src/DataTypes/GlobalSetDataType.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,18 @@ public function getRecords(): array
{
return Craft::$app->globals->getAllSets();
}

/**
* Reset craft global sets cache using reflection.
*/
public function afterImport()
{
$obj = Craft::$app->globals;
$refObject = new \ReflectionObject($obj);
if ($refObject->hasProperty('_allGlobalSets')) {
$refProperty1 = $refObject->getProperty('_allGlobalSets');
$refProperty1->setAccessible(true);
$refProperty1->setValue($obj, null);
}
}
}

0 comments on commit eb77d97

Please sign in to comment.