Skip to content

Commit

Permalink
don't require authenticated for getting public media
Browse files Browse the repository at this point in the history
  • Loading branch information
brookgagnon committed Sep 12, 2024
1 parent b55ae5c commit 23f2702
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions controllers/media.php
Original file line number Diff line number Diff line change
Expand Up @@ -617,17 +617,20 @@ public function delete()
*/
public function get()
{
$this->user->require_authenticated();

$id = $this->data('id');

$media = $this->models->media('get_by_id', ['id' => $id]);

//T Media not found.
if (!$media) {
return [false,'Media not found.'];
}

// if not public, require autenticated
if ($media['status'] != 'public') {
$this->user->require_authenticated();
}

if ($media['status'] == 'private' && $media['owner_id'] != $this->user->param('id')) {
$this->user->require_permission('manage_media');
}
Expand Down

0 comments on commit 23f2702

Please sign in to comment.