Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
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
Kulya
OpnSense
Commits
7e3188f3
Commit
7e3188f3
authored
May 03, 2015
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
prepare new MVC framework to use legacy ACL structure
parent
316e72b9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
0 deletions
+16
-0
ApiControllerBase.php
...e/mvc/app/controllers/OPNsense/Base/ApiControllerBase.php
+7
-0
ControllerBase.php
...ense/mvc/app/controllers/OPNsense/Base/ControllerBase.php
+9
-0
No files found.
src/opnsense/mvc/app/controllers/OPNsense/Base/ApiControllerBase.php
View file @
7e3188f3
...
...
@@ -28,6 +28,7 @@
*/
namespace
OPNsense\Base
;
use
OPNsense\Core\ACL
;
use
Phalcon\Mvc\Controller
;
/**
...
...
@@ -59,6 +60,12 @@ class ApiControllerBase extends Controller
$this
->
response
->
redirect
(
"/"
,
true
);
}
// Authorization using legacy acl structure
$acl
=
new
ACL
();
if
(
!
$acl
->
isPageAccessible
(
$this
->
session
->
get
(
"Username"
),
$_SERVER
[
'REQUEST_URI'
]))
{
$this
->
response
->
redirect
(
"/"
,
true
);
}
// check for valid csrf on post requests
$csrf_tokenkey
=
$this
->
request
->
getHeader
(
'X_CSRFTOKENKEY'
);
$csrf_token
=
$this
->
request
->
getHeader
(
'X_CSRFTOKEN'
);
...
...
src/opnsense/mvc/app/controllers/OPNsense/Base/ControllerBase.php
View file @
7e3188f3
...
...
@@ -29,6 +29,7 @@
namespace
OPNsense\Base
;
use
OPNsense\Core\Config
;
use
OPNsense\Core\ACL
;
use
Phalcon\Mvc\Controller
;
use
Phalcon\Translate\Adapter\NativeArray
;
...
...
@@ -75,6 +76,14 @@ class ControllerBase extends Controller
if
(
$this
->
session
->
has
(
"Username"
)
==
false
)
{
$this
->
response
->
redirect
(
"/"
,
true
);
}
// Authorization using legacy acl structure
$acl
=
new
ACL
();
if
(
!
$acl
->
isPageAccessible
(
$this
->
session
->
get
(
"Username"
),
$_SERVER
[
'REQUEST_URI'
]))
{
$this
->
response
->
redirect
(
"/"
,
true
);
}
// check for valid csrf on post requests
if
(
$this
->
request
->
isPost
()
&&
!
$this
->
security
->
checkToken
())
{
// post without csrf, exit.
...
...
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