Admins can see all playlists

This commit is contained in:
Josef Citrine 2016-11-21 11:41:16 +00:00
parent 0e6afe372b
commit 337caa23a8
2 changed files with 3 additions and 3 deletions

View file

@ -45,7 +45,7 @@ class EditPlaylistCommand extends CommandBase
{ {
$user = Auth::user(); $user = Auth::user();
return $this->_playlist && $user != null && $this->_playlist->user_id == $user->id; return $this->_playlist && $user != null && ($this->_playlist->user_id == $user->id || $user->hasRole('admin'));
} }
/** /**

View file

@ -134,7 +134,7 @@ class Playlist extends Model implements Searchable, Commentable, Favouritable
if (in_array($name, Track::$LosslessFormats) && !$playlist->hasLosslessTracksOnly() && !$playlist->hasLosslessTracks()) { if (in_array($name, Track::$LosslessFormats) && !$playlist->hasLosslessTracksOnly() && !$playlist->hasLosslessTracks()) {
continue; continue;
} }
$formats[] = [ $formats[] = [
'name' => $name, 'name' => $name,
'extension' => $format['extension'], 'extension' => $format['extension'],
@ -284,7 +284,7 @@ class Playlist extends Model implements Searchable, Commentable, Favouritable
public function canView($user) public function canView($user)
{ {
return $this->is_public || ($user != null && $user->id == $this->user_id); return $this->is_public || ($user != null && $user->id == $this->user_id) || ($user != null && $user->hasRole('admin'));
} }
public function getUrlAttribute() public function getUrlAttribute()