Skip to content

Commit

Permalink
fix tests?
Browse files Browse the repository at this point in the history
  • Loading branch information
ildyria committed Aug 19, 2023
1 parent d8fc6ff commit d0d10c0
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions app/Http/Requests/Sharing/ListSharingRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,20 @@ class ListSharingRequest extends BaseApiRequest implements HasBaseAlbum
*/
public function authorize(): bool
{
$id = Auth::id() ?? throw new UnauthenticatedException();
/** @var User $user */
$user = Auth::user() ?? throw new UnauthenticatedException();

if (!Gate::check(AlbumPolicy::CAN_SHARE_WITH_USERS, [AbstractAlbum::class, $this->album])) {
return false;
}

if ($user->may_administrate === true) {
return true;
}

if (
($this->owner?->id === $id) ||
($this->participant?->id === $id)
($this->owner?->id === $user->id) ||
($this->participant?->id === $user->id)
) {
return true;
}
Expand Down

0 comments on commit d0d10c0

Please sign in to comment.