diff --git a/framework/core/src/Core/Users/User.php b/framework/core/src/Core/Users/User.php index 57c7f0bfb..b12a23140 100755 --- a/framework/core/src/Core/Users/User.php +++ b/framework/core/src/Core/Users/User.php @@ -17,6 +17,7 @@ use Flarum\Events\UserBioWasChanged; use Flarum\Events\UserAvatarWasChanged; use Flarum\Events\UserWasActivated; use Flarum\Events\UserEmailChangeWasRequested; +use Flarum\Events\GetUserGroups; use Flarum\Core\Support\Locked; use Flarum\Core\Support\VisibleScope; use Flarum\Core\Support\EventGenerator; @@ -560,6 +561,8 @@ class User extends Model $groupIds = array_merge($groupIds, [Group::MEMBER_ID], $this->groups->lists('id')); } + event(new GetUserGroups($this, $groupIds)); + return Permission::whereIn('group_id', $groupIds); } diff --git a/framework/core/src/Events/GetUserGroups.php b/framework/core/src/Events/GetUserGroups.php new file mode 100644 index 000000000..231863c85 --- /dev/null +++ b/framework/core/src/Events/GetUserGroups.php @@ -0,0 +1,29 @@ +user = $user; + $this->groupIds = &$groupIds; + } +}