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
6816eb2f
Commit
6816eb2f
authored
Jul 02, 2015
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(proxy) add cron for acl update
parent
6c02d112
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
67 additions
and
1 deletion
+67
-1
SettingsController.php
...app/controllers/OPNsense/Proxy/Api/SettingsController.php
+38
-0
Proxy.xml
src/opnsense/mvc/app/models/OPNsense/Proxy/Proxy.xml
+14
-0
index.volt
src/opnsense/mvc/app/views/OPNsense/Proxy/index.volt
+15
-1
No files found.
src/opnsense/mvc/app/controllers/OPNsense/Proxy/Api/SettingsController.php
View file @
6816eb2f
...
@@ -30,6 +30,7 @@ namespace OPNsense\Proxy\Api;
...
@@ -30,6 +30,7 @@ namespace OPNsense\Proxy\Api;
use
\OPNsense\Base\ApiControllerBase
;
use
\OPNsense\Base\ApiControllerBase
;
use
\OPNsense\Proxy\Proxy
;
use
\OPNsense\Proxy\Proxy
;
use
\OPNsense\Cron\Cron
;
use
\OPNsense\Core\Config
;
use
\OPNsense\Core\Config
;
use
\OPNsense\Base\UIModelGrid
;
use
\OPNsense\Base\UIModelGrid
;
...
@@ -266,4 +267,41 @@ class SettingsController extends ApiControllerBase
...
@@ -266,4 +267,41 @@ class SettingsController extends ApiControllerBase
}
}
return
$result
;
return
$result
;
}
}
/**
* create new cron item for remote acl or return already available one
* @return array status action
*/
public
function
fetchRBCronAction
()
{
$result
=
array
(
"result"
=>
"failed"
);
if
(
$this
->
request
->
isPost
())
{
$mdlProxy
=
new
Proxy
();
if
((
string
)
$mdlProxy
->
forward
->
acl
->
remoteACLs
->
UpdateCron
==
""
)
{
$mdlCron
=
new
Cron
();
// update cron relation (if this doesn't break consistency)
$uuid
=
$mdlCron
->
newDailyJob
(
"Proxy"
,
"proxy fetchacls"
,
"fetch proxy acls"
,
"1"
);
$mdlProxy
->
forward
->
acl
->
remoteACLs
->
UpdateCron
=
$uuid
;
if
(
$mdlCron
->
performValidation
()
->
count
()
==
0
)
{
$mdlCron
->
serializeToConfig
();
// save data to config, do not validate because the current in memory model doesn't know about the
// cron item just created.
$mdlProxy
->
serializeToConfig
(
$validateFullModel
=
false
,
$disable_validation
=
true
);
Config
::
getInstance
()
->
save
();
$result
[
'result'
]
=
"new"
;
$result
[
'uuid'
]
=
$uuid
;
}
else
{
$result
[
'result'
]
=
"unable to add cron"
;
}
}
else
{
$result
[
'result'
]
=
"existing"
;
$result
[
'uuid'
]
=
(
string
)
$mdlProxy
->
forward
->
acl
->
remoteACLs
->
UpdateCron
;
}
}
return
$result
;
}
}
}
src/opnsense/mvc/app/models/OPNsense/Proxy/Proxy.xml
View file @
6816eb2f
...
@@ -220,6 +220,20 @@
...
@@ -220,6 +220,20 @@
</description>
</description>
</blacklist>
</blacklist>
</blacklists>
</blacklists>
<UpdateCron
type=
"ModelRelationField"
>
<Model>
<queues>
<source>
OPNsense.Cron.Cron
</source>
<items>
jobs.job
</items>
<display>
description
</display>
<filters>
<origin>
/Proxy/
</origin>
</filters>
</queues>
</Model>
<ValidationMessage>
Related cron not found
</ValidationMessage>
<Required>
N
</Required>
</UpdateCron>
</remoteACLs>
</remoteACLs>
</acl>
</acl>
<authentication>
<authentication>
...
...
src/opnsense/mvc/app/views/OPNsense/Proxy/index.volt
View file @
6816eb2f
...
@@ -58,7 +58,7 @@ POSSIBILITY OF SUCH DAMAGE.
...
@@ -58,7 +58,7 @@ POSSIBILITY OF SUCH DAMAGE.
/**
/**
*
*
* Reconfigure poxy - activate changes
* Reconfigure p
r
oxy - activate changes
*/
*/
$("#reconfigureAct").click(function(){
$("#reconfigureAct").click(function(){
$("#reconfigureAct_progress").addClass("fa fa-spinner fa-pulse");
$("#reconfigureAct_progress").addClass("fa fa-spinner fa-pulse");
...
@@ -97,6 +97,20 @@ POSSIBILITY OF SUCH DAMAGE.
...
@@ -97,6 +97,20 @@ POSSIBILITY OF SUCH DAMAGE.
});
});
});
});
/**
* setup cron item
*/
$("#ScheduleAct").click(function() {
$("#scheduleAct_progress").addClass("fa fa-spinner fa-pulse");
ajaxCall(url="/api/proxy/settings/fetchRBCron", sendData={}, callback=function(data,status) {
$("#scheduleAct_progress").removeClass("fa fa-spinner fa-pulse");
if (data.uuid !=undefined) {
// redirect to cron page
$(location).attr('href',"/ui/cron/item/open/"+data.uuid);
}
});
});
// form save event handlers for all defined forms
// form save event handlers for all defined forms
$('[id*="save_"]').each(function(){
$('[id*="save_"]').each(function(){
$(this).click(function() {
$(this).click(function() {
...
...
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