Skip to content
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/Auth/Eloquent/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Illuminate\Support\Carbon;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Hash;
use Statamic\Auth\PermissionCache;
use Statamic\Auth\User as BaseUser;
use Statamic\Contracts\Auth\Passkey;
use Statamic\Contracts\Auth\Role as RoleContract;
Expand Down Expand Up @@ -219,6 +220,12 @@ public function isInGroup($group)

public function permissions()
{
$cache = app(PermissionCache::class);

if ($cached = $cache->get($this->id)) {
return $cached;
}

$permissions = $this->groups()->flatMap->roles()
->merge($this->roles())
->flatMap->permissions();
Expand Down
Loading