rename function to avoid confusion

parent e4988df6
......@@ -205,11 +205,11 @@ class Restore(Resource):
return resp
@ns.route('/schedule-restore/<name>/<int:backup>',
'/<server>/schedule-restore/<name>/<int:backup>',
endpoint='schedule_restore')
class ScheduleRestore(Resource):
"""The :class:`burpui.api.restore.ScheduleRestore` resource allows you to
@ns.route('/sserver-restore/<name>/<int:backup>',
'/<server>/server-restore/<name>/<int:backup>',
endpoint='server_restore')
class ServerRestore(Resource):
"""The :class:`burpui.api.restore.ServerRestore` resource allows you to
prepare a file restoration.
This resource is part of the :mod:`burpui.api.restore` module.
......@@ -276,7 +276,7 @@ class ScheduleRestore(Resource):
api.bui.acl.is_admin(current_user.get_id()))):
api.abort(403, 'You are not allowed to perform a restoration for this client')
try:
j = api.bui.cli.schedule_restore(name, backup, l, s, f, p, to, server)
j = api.bui.cli.server_restore(name, backup, l, s, f, p, to, server)
return {'notif': j}, 201
except BUIserverException as e:
api.abort(500, str(e))
......@@ -817,8 +817,8 @@ class Burp(BUIbackend):
res.append(tree)
return res
def schedule_restore(self, name=None, backup=None, files=None, strip=None, force=None, prefix=None, restoreto=None, agent=None):
"""See :func:`burpui.misc.backend.interface.BUIbackend.schedule_restore`"""
def server_restore(self, name=None, backup=None, files=None, strip=None, force=None, prefix=None, restoreto=None, agent=None):
"""See :func:`burpui.misc.backend.interface.BUIbackend.server_restore`"""
if not name or not backup or not files:
raise BUIserverException('At least one argument is missing')
......
......@@ -651,8 +651,8 @@ class BUIbackend(BUIlogging):
raise NotImplementedError("Sorry, the current Backend does not implement this method!") # pragma: no cover
@abstractmethod
def schedule_restore(self, name=None, backup=None, files=None, strip=None, force=None, prefix=None, restoreto=None, agent=None):
"""The :func:`burpui.misc.backend.interface.BUIbackend.schedule_restore`
def server_restore(self, name=None, backup=None, files=None, strip=None, force=None, prefix=None, restoreto=None, agent=None):
"""The :func:`burpui.misc.backend.interface.BUIbackend.server_restore`
function is used to schedule a server-side initiated restoration.
:param name: Client name
......
......@@ -200,9 +200,9 @@ class Burp(BUIbackend):
"""See :func:`burpui.misc.backend.interface.BUIbackend.get_parser_attr`"""
return self.servers[agent].get_parser_attr(attr)
def schedule_restore(self, name=None, backup=None, files=None, strip=None, force=None, prefix=None, restoreto=None, agent=None):
"""See :func:`burpui.misc.backend.interface.BUIbackend.schedule_restore`"""
return self.servers[agent].schedule_restore(name, backup, files, strip, force, prefix, restoreto)
def server_restore(self, name=None, backup=None, files=None, strip=None, force=None, prefix=None, restoreto=None, agent=None):
"""See :func:`burpui.misc.backend.interface.BUIbackend.server_restore`"""
return self.servers[agent].server_restore(name, backup, files, strip, force, prefix, restoreto)
def _get_version_parallel(self, method=None):
"""Use :mod:`multiprocessing` or :mod:`gevent` to retrieve versions"""
......@@ -543,9 +543,9 @@ class NClient(BUIbackend, local):
data = {'func': 'get_parser_attr', 'args': {'attr': attr}}
return json.loads(self.do_command(data))
def schedule_restore(self, name=None, backup=None, files=None, strip=None, force=None, prefix=None, restoreto=None, agent=None):
"""See :func:`burpui.misc.backend.interface.BUIbackend.schedule_restore`"""
data = {'func': 'schedule_restore', 'args': {'name': name, 'backup': backup, 'files': files, 'strip': strip, 'force': force, 'prefix': prefix, 'restoreto': restoreto}}
def server_restore(self, name=None, backup=None, files=None, strip=None, force=None, prefix=None, restoreto=None, agent=None):
"""See :func:`burpui.misc.backend.interface.BUIbackend.server_restore`"""
data = {'func': 'server_restore', 'args': {'name': name, 'backup': backup, 'files': files, 'strip': strip, 'force': force, 'prefix': prefix, 'restoreto': restoreto}}
return json.loads(self.do_command(data))
def get_client_version(self, agent=None):
......
......@@ -942,7 +942,7 @@ class Parser(BUIparser):
if restoreto:
f.write('orig_client = {}\n'.format(name))
return [0, 'Restoration successfully scheduled']
return [0, 'Server-initiated restoration successfully scheduled']
except Exception as e:
raise BUIserverException(str(e))
......@@ -207,7 +207,7 @@ class BUIparser(BUIlogging):
@abstractmethod
def server_initiated_restoration(self, name=None, backup=None, files=None, strip=None, force=None, prefix=None):
""":func:`burpui.misc.parser.interface.BUIparser.server_initiated_restoration`
called by :func:`burpui.misc.backend.interface.BUIbackend.schedule_restore`
called by :func:`burpui.misc.backend.interface.BUIbackend.server_restore`
in order to create server-initiated restoration file.
:param name: Client name
......
......@@ -86,11 +86,11 @@
</div>
</div>
</form>
<form id="form-schedule" class="form-inline col-md-6 text-right" method="POST" role="form" action"{{ url_for('api.schedule_restore', name=cname, backup=nbackup, server=server) }}">
<form id="form-server-initiated" class="form-inline col-md-6 text-right" method="POST" role="form" action"{{ url_for('api.server_restore', name=cname, backup=nbackup, server=server) }}">
<input type="hidden" name="list-sc">
<div id="schedule-form" style="display:none;">
<div id="server-initiated-form" style="display:none;">
<div class="btn-group dropup">
<button type="submit" class="btn btn-info" id="perform-schedule"><span class="glyphicon glyphicon-cloud-upload"></span>&nbsp;Schedule restore</button>
<button type="submit" class="btn btn-info" id="perform-server-initiated"><span class="glyphicon glyphicon-cloud-upload"></span>&nbsp;Server initiated restore</button>
<button class="btn btn-info dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></button>
<ul class="dropdown-menu dropdown-menu-right browse">
<li><label for="strip-sc">Number of leading path components to strip:&nbsp;</label><input type="text" id="strip-sc" name="strip-sc" placeholder="0" autocomplete="off" maxlength="2" size="2" value="0"></li>
......
......@@ -111,7 +111,7 @@
var s = data.tree.getSelectedNodes();
if (s.length > 0) {
$("#restore-form").show();
$("#schedule-form").show();
$("#server-initiated-form").show();
v = [];
$.each(s, function(i, n) {
v.push({key: n.key, folder: n.folder});
......@@ -121,7 +121,7 @@
$("input[name=list-sc]").val(JSON.stringify(r));
} else {
$("#restore-form").hide();
$("#schedule-form").hide();
$("#server-initiated-form").hide();
$("input[name=list]").val('');
$("input[name=list-sc]").val('');
}
......@@ -200,12 +200,12 @@
e.preventDefault();
return false;
});
$("#form-schedule").on('submit', function(e) {
$("#form-server-initiated").on('submit', function(e) {
e.preventDefault();
var form = $(this);
/* FIXME: quick-fix cause i did not manage to get the form action */
var url = "{{ url_for('api.schedule_restore', name=cname, backup=nbackup, server=server) }}";
var url = "{{ url_for('api.server_restore', name=cname, backup=nbackup, server=server) }}";
$.ajax({
url: url,
type: 'PUT',
......
......@@ -50,6 +50,16 @@ You can refer to the `restoration <installation.html#restoration>`__ section of
this documentation along with the `version <usage.html#versions>`__ section for
more details.
What does the server-initiated restoration feature do and how to make it work?
------------------------------------------------------------------------------
This feature asks the server to perform a restoration on the client the next
time it sees it.
In order for this feature to work, your client **MUST** allows the server to do
that. You have to set ``server_can_restore = 1`` (which is the default value) in
your client configuration file (usually */etc/burp/burp.conf*).
How can I start Burp-UI as a daemon?
------------------------------------
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment