Commit d1afd6fc authored by Nicolas Widart's avatar Nicolas Widart

Merge commit '17dcea79'

* commit '17dcea79':
  Squashed 'Modules/Core/' changes from ccf32bf..b620e93
parents 65dac096 17dcea79
...@@ -138,6 +138,12 @@ $(function() { ...@@ -138,6 +138,12 @@ $(function() {
radioClass: 'iradio_minimal' radioClass: 'iradio_minimal'
}); });
if ($('.slugify').length) {
$('.slugify').slug({
slug: 'slug', // class of input / span that contains the generated slug
hide: false // hide the text input, true by default
});
}
}); });
function fix_sidebar() { function fix_sidebar() {
//Make sure the body tag has the .fixed class //Make sure the body tag has the .fixed class
......
This diff is collapsed.
...@@ -68,4 +68,10 @@ interface Authentication ...@@ -68,4 +68,10 @@ interface Authentication
* @return bool * @return bool
*/ */
public function hasAccess($permission); public function hasAccess($permission);
/**
* Check if the user is logged in
* @return mixed
*/
public function check();
} }
<?php namespace Modules\Core\Http\Filters; <?php namespace Modules\Core\Http\Filters;
use Cartalyst\Sentinel\Laravel\Facades\Sentinel; use Illuminate\Http\Request;
use Illuminate\Support\Facades\App; use Illuminate\Routing\Redirector;
use Illuminate\Support\Facades\Redirect; use Illuminate\Session\Store;
use Illuminate\Support\Facades\Request; use Illuminate\Foundation\Application;
use Illuminate\Support\Facades\Session; use Modules\Core\Contracts\Authentication;
class AdminFilter class AdminFilter
{ {
/**
* @var Authentication
*/
private $auth;
/**
* @var SessionManager
*/
private $session;
/**
* @var Request
*/
private $request;
/**
* @var Redirector
*/
private $redirect;
/**
* @var Application
*/
private $application;
public function __construct(Authentication $auth, Store $session, Request $request, Redirector $redirect, Application $application)
{
$this->auth = $auth;
$this->session = $session;
$this->request = $request;
$this->redirect = $redirect;
$this->application = $application;
}
public function filter() public function filter()
{ {
// Check if the user is logged in // Check if the user is logged in
if (!Sentinel::check()) { if (!$this->auth->check()) {
// Store the current uri in the session // Store the current uri in the session
Session::put('loginRedirect', Request::url()); $this->session->put('url.intended', $this->request->url());
// Redirect to the login page // Redirect to the login page
return Redirect::route('login'); return $this->redirect->route('login');
} }
// Check if the user has access to the dashboard page // Check if the user has access to the dashboard page
if ( ! Sentinel::getUser()->hasAccess('dashboard.index')) if ( ! $this->auth->hasAccess('dashboard.index'))
{ {
// Show the insufficient permissions page // Show the insufficient permissions page
return App::abort(403); return $this->application->abort(403);
} }
} }
} }
<?php namespace Modules\Core\Http\Filters; <?php namespace Modules\Core\Http\Filters;
use Cartalyst\Sentinel\Laravel\Facades\Sentinel;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Routing\Route; use Illuminate\Routing\Route;
use Illuminate\Support\Facades\Config; use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Redirect; use Illuminate\Support\Facades\Redirect;
use Laracasts\Flash\Flash; use Laracasts\Flash\Flash;
use Modules\Core\Contracts\Authentication;
class PermissionFilter class PermissionFilter
{ {
/**
* @var Authentication
*/
private $auth;
public function __construct(Authentication $auth)
{
$this->auth = $auth;
}
public function filter(Route $route, Request $request) public function filter(Route $route, Request $request)
{ {
$action = $route->getActionName(); $action = $route->getActionName();
...@@ -16,7 +26,7 @@ class PermissionFilter ...@@ -16,7 +26,7 @@ class PermissionFilter
$segmentPosition = $this->getSegmentPosition($request); $segmentPosition = $this->getSegmentPosition($request);
if (Sentinel::hasAccess("{$request->segment($segmentPosition)}.$actionMethod")) if ($this->auth->hasAccess("{$request->segment($segmentPosition)}.$actionMethod"))
{ {
return; return;
} }
......
...@@ -55,12 +55,13 @@ ...@@ -55,12 +55,13 @@
</aside><!-- /.right-side --> </aside><!-- /.right-side -->
</div><!-- ./wrapper --> </div><!-- ./wrapper -->
<script src="{{{ Module::asset('core', 'js/vendor/bootstrap.min.js') }}}" type="text/javascript"></script> <script src="{!! Module::asset('core', 'js/vendor/bootstrap.min.js') !!}" type="text/javascript"></script>
<script src="{{{ Module::asset('core', 'js/vendor/alertify/alertify.js') }}}" type="text/javascript"></script> <script src="{!! Module::asset('core', 'js/vendor/alertify/alertify.js') !!}" type="text/javascript"></script>
<script src="{{{ Module::asset('core', 'js/vendor/iCheck/icheck.min.js') }}}" type="text/javascript"></script> <script src="{!! Module::asset('core', 'js/vendor/iCheck/icheck.min.js') !!}" type="text/javascript"></script>
<script src="{{{ Module::asset('core', 'js/vendor/datatables/jquery.dataTables.js') }}}" type="text/javascript"></script> <script src="{!! Module::asset('core', 'js/vendor/datatables/jquery.dataTables.js') !!}" type="text/javascript"></script>
<script src="{{{ Module::asset('core', 'js/vendor/datatables/dataTables.bootstrap.js') }}}" type="text/javascript"></script> <script src="{!! Module::asset('core', 'js/vendor/datatables/dataTables.bootstrap.js') !!}" type="text/javascript"></script>
<script src="{{{ Module::asset('core', 'js/app.js') }}}" type="text/javascript"></script> <script src="{!! Module::asset('core', 'js/vendor/jquery.slug.js') !!}" type="text/javascript"></script>
<script src="{!! Module::asset('core', 'js/app.js') !!}" type="text/javascript"></script>
@section('scripts') @section('scripts')
@show @show
</body> </body>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment