#1: Darklaunched search to site staff.

This commit is contained in:
Peter Deltchev 2016-01-17 05:43:28 -08:00
parent e295c41243
commit 33befbe3d0
3 changed files with 8 additions and 2 deletions

View file

@ -82,7 +82,7 @@ Route::group(['prefix' => 'api/v1', 'middleware' => 'json-exceptions'], function
Route::group(['prefix' => 'api/web'], function() {
Route::get('/taxonomies/all', 'Api\Web\TaxonomiesController@getAll');
Route::get('/search', 'Api\Web\SearchController@getSearch');
Route::get('/search', ['middleware' => ['auth', 'can:access-search'], 'Api\Web\SearchController@getSearch']);
Route::get('/tracks', 'Api\Web\TracksController@getIndex');
Route::get('/tracks/{id}', 'Api\Web\TracksController@getShow')->where('id', '\d+');

View file

@ -48,6 +48,10 @@ class AuthServiceProvider extends ServiceProvider
*/
public function boot(GateContract $gate)
{
$gate->define('access-search', function(User $user) {
return $user->hasRole('admin') || $user->hasRole('moderator');
});
$gate->define('access-admin-area', function(User $user) {
return $user->hasRole('admin');
});

View file

@ -66,7 +66,9 @@
<div class="site-body">
<ul class="sidebar" ng-controller="sidebar">
<li><pfm-search></pfm-search></li>
@can('access-search')
<li><pfm-search></pfm-search></li>
@endcan
<li ng-class="{selected: stateIncludes('content.tracks') || stateIncludes('content.track')}"><a href="/tracks">Tracks</a></li>
<li ng-class="{selected: stateIncludes('content.albums') || stateIncludes('content.album')}"><a href="/albums">Albums</a></li>
<li ng-class="{selected: stateIncludes('content.playlists') || stateIncludes('content.playlist')}"><a href="/playlists">Playlists</a></li>