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
d3fe1cff
Commit
d3fe1cff
authored
Jul 02, 2015
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(proxy) change to new validation behavior
parent
b814e215
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
20 deletions
+6
-20
SettingsController.php
...app/controllers/OPNsense/Proxy/Api/SettingsController.php
+6
-20
No files found.
src/opnsense/mvc/app/controllers/OPNsense/Proxy/Api/SettingsController.php
View file @
d3fe1cff
...
...
@@ -164,19 +164,12 @@ class SettingsController extends ApiControllerBase
$valMsgs
=
$mdlProxy
->
performValidation
();
foreach
(
$valMsgs
as
$field
=>
$msg
)
{
$fieldnm
=
str_replace
(
$node
->
__reference
,
"blacklist"
,
$msg
->
getField
());
if
(
$fieldnm
!=
$msg
->
getField
())
{
// only collect validation errors for the item we're currently editing.
$result
[
"validations"
][
$fieldnm
]
=
$msg
->
getMessage
();
}
}
if
(
count
(
$result
[
'validations'
])
==
0
)
{
// we've already performed a validation, prevent issues
// from other items in the model reflecting back to us.
$mdlProxy
->
serializeToConfig
(
$disable_validation
=
true
);
// save config if validated correctly
$mdlProxy
->
serializeToConfig
();
Config
::
getInstance
()
->
save
();
$result
=
array
(
"result"
=>
"saved"
);
}
...
...
@@ -203,19 +196,12 @@ class SettingsController extends ApiControllerBase
foreach
(
$valMsgs
as
$field
=>
$msg
)
{
$fieldnm
=
str_replace
(
$node
->
__reference
,
"blacklist"
,
$msg
->
getField
());
if
(
$fieldnm
!=
$msg
->
getField
())
{
// only collect validation errors for the item we're currently editing.
$result
[
"validations"
][
$fieldnm
]
=
$msg
->
getMessage
();
}
}
if
(
count
(
$result
[
'validations'
])
==
0
)
{
// we've already performed a validation, prevent issues from
// other items in the model reflecting back to us.
$mdlProxy
->
serializeToConfig
(
$disable_validation
=
true
);
// save config if validated correctly
$mdlProxy
->
serializeToConfig
();
Config
::
getInstance
()
->
save
();
$result
=
array
(
"result"
=>
"saved"
);
}
...
...
@@ -239,7 +225,7 @@ class SettingsController extends ApiControllerBase
if
(
$uuid
!=
null
)
{
if
(
$mdlProxy
->
forward
->
acl
->
remoteACLs
->
blacklists
->
blacklist
->
del
(
$uuid
))
{
// if item is removed, serialize to config and save
$mdlProxy
->
serializeToConfig
(
$disable_validation
=
true
);
$mdlProxy
->
serializeToConfig
();
Config
::
getInstance
()
->
save
();
$result
[
'result'
]
=
'deleted'
;
}
else
{
...
...
@@ -273,7 +259,7 @@ class SettingsController extends ApiControllerBase
$node
->
enabled
=
"1"
;
}
// if item has toggled, serialize to config and save
$mdlProxy
->
serializeToConfig
(
$disable_validation
=
true
);
$mdlProxy
->
serializeToConfig
();
Config
::
getInstance
()
->
save
();
}
}
...
...
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