Allow head djs to access the panel
Diff
app/Http/routes.php | 2 +-
app/Models/Group.php | 1 +
app/Http/Middleware/IsGroup.php | 2 +-
resources/views/layouts/main.blade.php | 2 +-
resources/views/layouts/nav.blade.php | 2 +-
app/Http/Controllers/Auth/AuthController.php | 2 +-
6 files changed, 6 insertions(+), 5 deletions(-)
@@ -41,7 +41,7 @@
'as' => 'dj::',
'prefix' => 'dj',
'namespace' => 'DJ',
'middleware' => sprintf('is:%s', Group::RADIO_DJ)
'middleware' => sprintf('is:%s,%s,%s', Group::RADIO_DJ, Group::HEAD_DJ, Group::GUEST_DJ)
], function () {
// DJ Says routes
Route::get('says', ['as' => 'says', 'uses' => 'DJSaysController@getForm']);
@@ -20,6 +20,7 @@
const STAFF_PREFIX = '[STAFF]';
const GUEST_DJ = 'Guest DJ';
const RADIO_DJ = 'Radio DJ';
const HEAD_DJ = 'Head DJ';
const EVENT = 'Events';
const SENIOR_EVENTS = 'Senior Events';
const MANAGEMENT = 'Management';
@@ -42,7 +42,7 @@
return redirect()->route('dashboard::home');
}
} elseif (!Auth::user()->is($group)) {
} elseif (!Auth::user()->is(...explode(',', $group))) {
Session::flash('msg', [
'type' => 'danger',
'msg' => sprintf('%s %s',
@@ -31,7 +31,7 @@
var PUSHER_CLUSTER = "{{ env('PUSHER_CLUSTER') }}";
var PUSHER_ENDPOINT = "{{ route('auth::pusher') }}";
var CSRF_TOKEN = "{{ csrf_token() }}";
var IS_DJ = {{ auth()->user()->is(App\Models\Group::RADIO_DJ, App\Models\Group::GUEST_DJ) ? 'true' : 'false' }};
var IS_DJ = {{ auth()->user()->is(App\Models\Group::RADIO_DJ, App\Models\Group::HEAD_DJ, App\Models\Group::GUEST_DJ) ? 'true' : 'false' }};
</script>
<script src="{{ elixir('js/main.js') }}"></script>
</body>
@@ -26,7 +26,7 @@
<i class="material-icons">home</i> {{ _('Home') }}
</a>
@if(auth()->user()->is(App\Models\Group::RADIO_DJ, App\Models\Group::GUEST_DJ))
@if(auth()->user()->is(App\Models\Group::RADIO_DJ, App\Models\Group::GUEST_DJ, App\Models\Group::HEAD_DJ))
<div class="zpan-drawer-separator"></div>
<span class="mdl-navigation__link" href>DJ</span>
@@ -42,7 +42,7 @@
switch ($request->get('channel_name')) {
case 'private-dj':
// trying to subscribe to DJ push notifications. ensure they're a DJ.
if (!auth()->user()->is(Group::RADIO_DJ, Group::GUEST_DJ)) {
if (!auth()->user()->is(Group::RADIO_DJ, Group::GUEST_DJ, Group::HEAD_DJ)) {
abort(403, _('Unauthorized.'));
}
break;