Example #1
0
});
App::after(function ($request, $response) {
    //
});
/*
|--------------------------------------------------------------------------
| Authentication Filters
|--------------------------------------------------------------------------
|
| The following filters are used to verify that the user of the current
| session is logged into this application. The "basic" filter easily
| integrates HTTP Basic authentication for quick, simple checking.
|
*/
Route::filter('auth', function () {
    if (!Auth::is('Super Admin')) {
        dd('this sucks');
        if (Request::ajax()) {
            return Response::make('Unauthorized', 401);
        } else {
            return Redirect::to('login')->withErrors([0 => 'blah']);
        }
    }
});
Route::filter('auth.basic', function () {
    return Auth::basic();
});
/*
|--------------------------------------------------------------------------
| Guest Filter
|--------------------------------------------------------------------------
Example #2
0
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="content-type" content="text/html; charset=UTF-8"></meta>
        <link rel="Stylesheet" type="text/css" href="~/css/bootstrap.css" />
		<link rel="Stylesheet" type="text/css" href="~/css/bootstrap/bootstrap-responsive.css" />
        <link rel="Stylesheet" type="text/css" href="~/css/960_12_col.css" /> 
        <link rel="Stylesheet" type="text/css" href="~/css/style.css" /> 
		<link rel="Stylesheet" type="text/css" href="~/css/select2.css" /> 
		<link rel="Stylesheet" type="text/css" href="~/datepicker/css/datepicker.css" /> 

		<script type="text/javascript" src="~/js/jquery-1.7.2.js"></script>
		<!--
		<link rel="Stylesheet" type="text/css" href="~/js/ckeditor/skins/BootstrapCK-Skin/editor.css" />
	   
		<script type="text/javascript" src="~/js/ckeditor/config.js"></script>		
		<script type="text/javascript" src="~/js/ckeditor/skins/BootstrapCK-Skin/skin.js"></script> 
		<script type="text/javascript" src="~/js/ckeditor/lang/pt-br.js"></script>
		<script type="text/javascript" src="~/js/ckeditor/plugins/styles/styles/default.js"></script>
		-->
		<script type="text/javascript" src="~/datepicker/js/bootstrap-datepicker.js"></script>
		<script type="text/javascript" src="~/js/bootstrap.js"></script>
		<script type="text/javascript" src="~/js/select2.js"></script>
        <script type="text/javascript" src="~/js/js.js"></script>
		<script type="text/javascript" src="~/js/jquery.maskedinput-1.3.js"></script>
        <title>CI</title>
		<script type="text/javascript">
			var root = '<?php 
echo root_virtual;
?>
';
Example #3
0
 /**
  * checks if user is logged in && has login role
  *
  * @return bool
  * */
 public function gotin_check()
 {
     return !Auth::is('Login') || is_null($this->user()) ? false : true;
 }
 /**
  * Test taking the second user a role.
  *
  * @test
  */
 public function testTakingRole()
 {
     \Auth::takeRole('Admin', 1);
     $output = \Auth::is('Admin', 1);
     $this->assertFalse($output);
 }
Example #5
0
    // add styles to layout
    Asset::container('header')->add('bootstrap_style', 'bundles/gotin/css/bootstrap.css');
    Asset::container('header')->add('bootstrap_res', 'bundles/gotin/css/bootstrap-responsive.css');
    Asset::container('header')->add('docs_style', 'bundles/gotin/css/gotin.css');
    Asset::container('header')->add('gotin_style', 'bundles/gotin/css/docs.css');
    // add scripts to layout
    Asset::container('header')->add('jquery', 'bundles/gotin/js/jquery.js');
    Asset::container('header')->add('bootstrap', 'bundles/gotin/js/bootstrap.min.js');
    if (Config::get('gotin::gotin.login_mode') == "ajax") {
        Asset::container('header')->add('gotin', 'bundles/gotin/js/gotin.js');
    }
});
/**
 * Filter admin access
 */
Route::filter('auth', function () {
    if (!Auth::gotin_check()) {
        Auth::logout();
        return Redirect::to_action('login');
    }
    // Admin role protected routes
    $admin_protected = array('users', 'roles');
    $gotin_route = Bundle::get('gotin')['handles'];
    foreach ($admin_protected as $ap) {
        $r = $gotin_route . "\\/" . $ap;
        $match = preg_match("/" . $r . "/", URI::current());
        if ($match && !Auth::is("Admin")) {
            return Redirect::to_action('gotin::dashboard');
        }
    }
});