Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Platform
Commits
d1afd6fc
Commit
d1afd6fc
authored
Oct 28, 2014
by
Nicolas Widart
Browse files
Options
Browse Files
Download
Plain Diff
Merge commit '
17dcea79
'
* commit '
17dcea79
': Squashed 'Modules/Core/' changes from ccf32bf..b620e93
parents
65dac096
17dcea79
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
201 additions
and
18 deletions
+201
-18
app.js
Modules/Core/Assets/js/app.js
+6
-0
jquery.slug.js
Modules/Core/Assets/js/vendor/jquery.slug.js
+130
-0
Authentication.php
Modules/Core/Contracts/Authentication.php
+6
-0
AdminFilter.php
Modules/Core/Http/Filters/AdminFilter.php
+40
-10
PermissionFilter.php
Modules/Core/Http/Filters/PermissionFilter.php
+12
-2
master.blade.php
Modules/Core/Resources/views/layouts/master.blade.php
+7
-6
No files found.
Modules/Core/Assets/js/app.js
View file @
d1afd6fc
...
...
@@ -138,6 +138,12 @@ $(function() {
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
()
{
//Make sure the body tag has the .fixed class
...
...
Modules/Core/Assets/js/vendor/jquery.slug.js
0 → 100644
View file @
d1afd6fc
This diff is collapsed.
Click to expand it.
Modules/Core/Contracts/Authentication.php
View file @
d1afd6fc
...
...
@@ -68,4 +68,10 @@ interface Authentication
* @return bool
*/
public
function
hasAccess
(
$permission
);
/**
* Check if the user is logged in
* @return mixed
*/
public
function
check
();
}
Modules/Core/Http/Filters/AdminFilter.php
View file @
d1afd6fc
<?php
namespace
Modules\Core\Http\Filters
;
use
Cartalyst\Sentinel\Laravel\Facades\Sentinel
;
use
Illuminate\
Support\Facades\App
;
use
Illuminate\S
upport\Facades\Redirect
;
use
Illuminate\
Support\Facades\Request
;
use
Illuminate\Support\Facades\Sess
ion
;
use
Illuminate\Http\Request
;
use
Illuminate\
Routing\Redirector
;
use
Illuminate\S
ession\Store
;
use
Illuminate\
Foundation\Application
;
use
Modules\Core\Contracts\Authenticat
ion
;
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
()
{
// Check if the user is logged in
if
(
!
Sentinel
::
check
())
{
if
(
!
$this
->
auth
->
check
())
{
// 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
return
Redirect
::
route
(
'login'
);
return
$this
->
redirect
->
route
(
'login'
);
}
// 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
return
App
::
abort
(
403
);
return
$this
->
application
->
abort
(
403
);
}
}
}
Modules/Core/Http/Filters/PermissionFilter.php
View file @
d1afd6fc
<?php
namespace
Modules\Core\Http\Filters
;
use
Cartalyst\Sentinel\Laravel\Facades\Sentinel
;
use
Illuminate\Http\Request
;
use
Illuminate\Routing\Route
;
use
Illuminate\Support\Facades\Config
;
use
Illuminate\Support\Facades\Redirect
;
use
Laracasts\Flash\Flash
;
use
Modules\Core\Contracts\Authentication
;
class
PermissionFilter
{
/**
* @var Authentication
*/
private
$auth
;
public
function
__construct
(
Authentication
$auth
)
{
$this
->
auth
=
$auth
;
}
public
function
filter
(
Route
$route
,
Request
$request
)
{
$action
=
$route
->
getActionName
();
...
...
@@ -16,7 +26,7 @@ class PermissionFilter
$segmentPosition
=
$this
->
getSegmentPosition
(
$request
);
if
(
Sentinel
::
hasAccess
(
"
{
$request
->
segment
(
$segmentPosition
)
}
.
$actionMethod
"
))
if
(
$this
->
auth
->
hasAccess
(
"
{
$request
->
segment
(
$segmentPosition
)
}
.
$actionMethod
"
))
{
return
;
}
...
...
Modules/Core/Resources/views/layouts/master.blade.php
View file @
d1afd6fc
...
...
@@ -55,12 +55,13 @@
</aside>
<!-- /.right-side -->
</div>
<!-- ./wrapper -->
<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/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/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/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/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/dataTables.bootstrap.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')
@show
</body>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment