🏡 index : ~doyle/zpan.git

author Jordan Doyle <jordan@doyle.wf> 2016-06-22 17:35:39.0 +01:00:00
committer Jordan Doyle <jordan@doyle.wf> 2016-06-22 17:35:39.0 +01:00:00
commit
f7e37f9df6ae425191c199d00309cbdaae859a4a [patch]
tree
d441a7ede9ada36cc33e01edba4b7d1614484cc2
parent
270d517d138471dcabe375811dbbbb863e383c27
download
f7e37f9df6ae425191c199d00309cbdaae859a4a.tar.gz

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(-)

diff --git a/app/Http/routes.php b/app/Http/routes.php
index d179310..989397b 100644
--- a/app/Http/routes.php
+++ a/app/Http/routes.php
@@ -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']);
diff --git a/app/Models/Group.php b/app/Models/Group.php
index 1fc2807..6692395 100644
--- a/app/Models/Group.php
+++ a/app/Models/Group.php
@@ -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';
diff --git a/app/Http/Middleware/IsGroup.php b/app/Http/Middleware/IsGroup.php
index 5574fba..0892888 100644
--- a/app/Http/Middleware/IsGroup.php
+++ a/app/Http/Middleware/IsGroup.php
@@ -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',
diff --git a/resources/views/layouts/main.blade.php b/resources/views/layouts/main.blade.php
index b34c3e4..1cc8d85 100644
--- a/resources/views/layouts/main.blade.php
+++ a/resources/views/layouts/main.blade.php
@@ -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>
diff --git a/resources/views/layouts/nav.blade.php b/resources/views/layouts/nav.blade.php
index 878f9b8..15e6abd 100644
--- a/resources/views/layouts/nav.blade.php
+++ a/resources/views/layouts/nav.blade.php
@@ -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>
diff --git a/app/Http/Controllers/Auth/AuthController.php b/app/Http/Controllers/Auth/AuthController.php
index 84523b6..c7e9274 100644
--- a/app/Http/Controllers/Auth/AuthController.php
+++ a/app/Http/Controllers/Auth/AuthController.php
@@ -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;