Пример #1
0
 public function getDeleteApiApplication($application_id)
 {
     // Lets go a quick look to see if this application
     // already exists in the database
     $application = SeatApiApplication::find($application_id);
     if (!$application) {
         App::abort(404);
     }
     // Create a new API Application
     $application->delete();
     return Redirect::back()->with('success', 'The application has been deleted!');
 }
Пример #2
0
|
*/
Route::filter('auth', function () {
    if (!\Auth::check()) {
        return Redirect::action('SessionController@getSignIn');
    }
});
Route::filter('auth.superuser', function () {
    if (!\Auth::check() || !\Auth::isSuperUser()) {
        return Redirect::to('/');
    }
});
// filter to check api app authentication
Route::filter('auth.api', function ($route, $request) {
    // check for application that matches login, password and ip
    $user = \SeatApiApplication::where('application_login', '=', $request->getUser())->where('application_password', '=', $request->getPassword())->where('application_ip', '=', Request::getClientIp())->exists();
    // if we cant find an app with those details, respond to the request
    if (!$user) {
        return Response::json(array('error' => true, 'message' => 'Invalid application credentials or request source.'), 401);
    }
    // also check to make sure that the request is over https
    if (!\Request::secure()) {
        return Response::json(array('error' => true, 'message' => 'API Access is only permitted via HTTPs.'), 401);
    }
});
/*
|--------------------------------------------------------------------------
| Guest Filter
|--------------------------------------------------------------------------
|
| The "guest" filter is the counterpart of the authentication filters as