Skip to content

Commit

Permalink
refactor: logic for only_logged_in policy
Browse files Browse the repository at this point in the history
  • Loading branch information
mwargan committed Apr 13, 2024
1 parent 97ac43e commit 7ac9978
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/Policies/MarkerPolicy.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ public function create(?User $user, Map $map, $token = null)
if ($user && $map->user_id == $user->id) {
return true;
}
if ($map->users_can_create_markers == 'only_logged_in') {
return $user && $user->hasVerifiedEmail() && $user->can('create markers');
if ($map->users_can_create_markers == 'only_logged_in' && $user && $user->hasVerifiedEmail() && $user->can('create markers')) {
return true;
}
// If the user is a member of the map and has the `can_create_markers` permission, they can create markers
if ($user && $map->users->contains($user) && $map->users->find($user->id)->pivot->can_create_markers) {
Expand Down

0 comments on commit 7ac9978

Please sign in to comment.