aboutsummaryrefslogtreecommitdiff
path: root/src/filters.php
blob: 11f00961ed951f2387d58c07c12fc05ce6b12889 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<?php
Route::filter('administrator', function(){
    Auth::basic();

    if (!Auth::user()->isAdministrator) {
        throw new \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException();
    }
});

Route::filter('current_user', function(){
    Auth::basic();

    if (empty(Auth::user()) || Route::input('user') != Auth::user()->id) {
        throw new \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException();
    }
});