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
d1e5d32e
Commit
d1e5d32e
authored
Oct 12, 2015
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(captiveportal, new) add configd actions to reconfigure
parent
de008540
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
8 deletions
+23
-8
ServiceController.php
...trollers/OPNsense/CaptivePortal/Api/ServiceController.php
+19
-4
SettingsController.php
...rollers/OPNsense/CaptivePortal/Api/SettingsController.php
+4
-4
No files found.
src/opnsense/mvc/app/controllers/OPNsense/CaptivePortal/Api/ServiceController.php
View file @
d1e5d32e
...
@@ -30,6 +30,7 @@ namespace OPNsense\CaptivePortal\Api;
...
@@ -30,6 +30,7 @@ namespace OPNsense\CaptivePortal\Api;
use
\OPNsense\Base\ApiControllerBase
;
use
\OPNsense\Base\ApiControllerBase
;
use
\OPNsense\Core\Backend
;
use
\OPNsense\Core\Backend
;
use
\OPNsense\CaptivePortal\CaptivePortal
;
/**
/**
* Class ServiceController
* Class ServiceController
...
@@ -53,11 +54,25 @@ class ServiceController extends ApiControllerBase
...
@@ -53,11 +54,25 @@ class ServiceController extends ApiControllerBase
$bckresult
=
trim
(
$backend
->
configdRun
(
"ipfw reload"
));
$bckresult
=
trim
(
$backend
->
configdRun
(
"ipfw reload"
));
if
(
$bckresult
==
"OK"
)
{
if
(
$bckresult
==
"OK"
)
{
// generate captive portal config
// generate captive portal config
$backend
->
configdRun
(
"template reload OPNsense.Captiveportal"
);
$bckresult
=
trim
(
$backend
->
configdRun
(
"template reload OPNsense.Captiveportal"
));
// TODO: implement portal webservers restart/reconfigure
if
(
$bckresult
==
"OK"
)
{
$status
=
"ok"
;
$mdlCP
=
new
CaptivePortal
();
if
(
$mdlCP
->
isEnabled
())
{
$bckresult
=
trim
(
$backend
->
configdRun
(
"captiveportal restart"
));
if
(
$bckresult
==
"OK"
)
{
$status
=
"ok"
;
}
else
{
$status
=
"error reloading captive portal"
;
}
}
else
{
$backend
->
configdRun
(
"captiveportal restart"
);
$status
=
"ok"
;
}
}
else
{
$status
=
"error reloading captive portal template"
;
}
}
else
{
}
else
{
$status
=
"error reloading captive portal ("
.
$bckresult
.
")"
;
$status
=
"error reloading captive portal
rules
("
.
$bckresult
.
")"
;
}
}
return
array
(
"status"
=>
$status
);
return
array
(
"status"
=>
$status
);
...
...
src/opnsense/mvc/app/controllers/OPNsense/CaptivePortal/Api/SettingsController.php
View file @
d1e5d32e
...
@@ -43,16 +43,16 @@ class SettingsController extends ApiControllerBase
...
@@ -43,16 +43,16 @@ class SettingsController extends ApiControllerBase
* validate and save model after update or insertion.
* validate and save model after update or insertion.
* Use the reference node and tag to rename validation output for a specific node to a new offset, which makes
* Use the reference node and tag to rename validation output for a specific node to a new offset, which makes
* it easier to reference specific uuids without having to use them in the frontend descriptions.
* it easier to reference specific uuids without having to use them in the frontend descriptions.
* @param $mdl
Shaper
* @param $mdl
model reference
* @param $node reference node, to use as relative offset
* @param $node reference node, to use as relative offset
* @param $reference reference for validation output, used to rename the validation output keys
* @param $reference reference for validation output, used to rename the validation output keys
* @return array result / validation output
* @return array result / validation output
*/
*/
private
function
save
(
$mdl
Shaper
,
$node
=
null
,
$reference
=
null
)
private
function
save
(
$mdl
,
$node
=
null
,
$reference
=
null
)
{
{
$result
=
array
(
"result"
=>
"failed"
,
"validations"
=>
array
());
$result
=
array
(
"result"
=>
"failed"
,
"validations"
=>
array
());
// perform validation
// perform validation
$valMsgs
=
$mdl
Shaper
->
performValidation
();
$valMsgs
=
$mdl
->
performValidation
();
foreach
(
$valMsgs
as
$field
=>
$msg
)
{
foreach
(
$valMsgs
as
$field
=>
$msg
)
{
// replace absolute path to attribute for relative one at uuid.
// replace absolute path to attribute for relative one at uuid.
if
(
$node
!=
null
)
{
if
(
$node
!=
null
)
{
...
@@ -66,7 +66,7 @@ class SettingsController extends ApiControllerBase
...
@@ -66,7 +66,7 @@ class SettingsController extends ApiControllerBase
// serialize model to config and save when there are no validation errors
// serialize model to config and save when there are no validation errors
if
(
count
(
$result
[
'validations'
])
==
0
)
{
if
(
count
(
$result
[
'validations'
])
==
0
)
{
// save config if validated correctly
// save config if validated correctly
$mdl
Shaper
->
serializeToConfig
();
$mdl
->
serializeToConfig
();
Config
::
getInstance
()
->
save
();
Config
::
getInstance
()
->
save
();
$result
=
array
(
"result"
=>
"saved"
);
$result
=
array
(
"result"
=>
"saved"
);
...
...
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