Skip to content

Commit 7ac9978

Browse files
committed
refactor: logic for only_logged_in policy
1 parent 97ac43e commit 7ac9978

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

app/Policies/MarkerPolicy.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ public function create(?User $user, Map $map, $token = null)
5858
if ($user && $map->user_id == $user->id) {
5959
return true;
6060
}
61-
if ($map->users_can_create_markers == 'only_logged_in') {
62-
return $user && $user->hasVerifiedEmail() && $user->can('create markers');
61+
if ($map->users_can_create_markers == 'only_logged_in' && $user && $user->hasVerifiedEmail() && $user->can('create markers')) {
62+
return true;
6363
}
6464
// If the user is a member of the map and has the `can_create_markers` permission, they can create markers
6565
if ($user && $map->users->contains($user) && $map->users->find($user->id)->pivot->can_create_markers) {

0 commit comments

Comments
 (0)