fix: burp-setting panel was broken in multi-agent mode (see #251)

parent 41928383
......@@ -430,7 +430,7 @@ class NewClientSettings(Resource):
# if not clientconfdir:
# flash('Could not proceed, no \'clientconfdir\' find', 'warning')
# return redirect(request.referrer)
noti = bui.client.store_conf_cli(ImmutableMultiDict(), newclient, None, server)
noti = bui.client.store_conf_cli(ImmutableMultiDict(), newclient, None, agent=server)
if server:
noti.append([NOTIF_INFO, _('<a href="%(url)s">Click here</a> to edit \'%(client)s\' configuration', url=url_for('view.cli_settings', server=server, client=newclient), client=newclient)])
else:
......
......@@ -1068,6 +1068,7 @@ def diag(client, host, tips):
def sysinfo(verbose, load):
"""Returns a couple of system informations to help debugging."""
from .desc import __release__, __version__
import platform
msg = None
if load:
......@@ -1089,6 +1090,9 @@ def sysinfo(verbose, load):
click.echo('Python version: {}.{}.{}'.format(sys.version_info[0], sys.version_info[1], sys.version_info[2]))
click.echo('Burp-UI version: {} ({})'.format(__version__, __release__))
click.echo('OS: {}:{} ({})'.format(platform.system(), platform.release(), os.name))
if platform.system() == 'Linux':
click.echo('Distribution: {} {} {}'.format(*platform.dist()))
click.echo('Single mode: {}'.format(app.standalone))
click.echo('Backend version: {}'.format(backend_version))
click.echo('WebSocket embedded: {}'.format(click.style(embedded_ws, fg=colors[embedded_ws])))
......
......@@ -10,7 +10,7 @@
from .interface import BUIacl
from ...utils import make_list
from six import iteritems
from six import iteritems, itervalues
import re
import json
......@@ -242,6 +242,13 @@ class BUIgrantHandler(BUImetaGrant, BUIacl):
"""parse and set the moderators grants"""
self.set_grant(self._gp_moderator_name, grants)
def get_member_groups(self, member):
groups = []
for group in itervalues(self._groups):
if group.is_member(member):
groups.append(group.name)
return groups
def _extract_grants(self, username):
if username not in self._parsed_grants:
......@@ -465,7 +472,7 @@ class BUIaclGroup(object):
represent a Group"""
def __init__(self, name, members=None):
self.name = name
self._name = name
self._set_members(members)
def _parse_members(self, members):
......@@ -491,6 +498,12 @@ class BUIaclGroup(object):
def is_member(self, member):
return member in self._members
@property
def name(self):
if self._name and any(self._name.startswith(x) for x in ['@', '+']):
return str(self._name[1:])
return self._name
@property
def members(self):
return list(self._members)
......@@ -501,7 +514,7 @@ class BUIaclGrant(BUImetaGrant):
represent a Grant"""
def __init__(self, name, grants):
self.name = name
self._name = name
self._grants = self._parse_grants(grants)
def _parse_grants(self, grants):
......@@ -517,6 +530,12 @@ class BUIaclGrant(BUImetaGrant):
ret = make_list(grants)
return ret
@property
def name(self):
if self._name and any(self._name.startswith(x) for x in ['@', '+']):
return str(self._name[1:])
return self._name
@property
def grants(self):
return self._grants
......
......@@ -373,7 +373,7 @@ class NClient(BUIbackend):
self.ssl = ssl
self.app = app
self.timeout = timeout or 5
self.version = None
self._agent_version = None
def __getattribute__(self, name):
# always return this value because we need it and if we don't do that
......@@ -398,15 +398,15 @@ class NClient(BUIbackend):
return object.__getattribute__(self, name)
def _get_agent_version(self):
if self.ping() and not self.version:
if self.ping() and not self._agent_version:
data = {'func': 'agent_version'}
try:
self.version = json.loads(self.do_command(data))
self._agent_version = json.loads(self.do_command(data))
except BUIserverException:
# just ignore the error if this custom function is not
# implemented
pass
return self.version
return self._agent_version
def ping(self):
"""Check if we are connected to the agent"""
......
......@@ -109,10 +109,32 @@ app.controller('AdminCtrl', ['$scope', '$http', '$scrollspy', 'DTOptionsBuilder'
}]);
var _me = undefined;
var _users_table = $('#table-users').DataTable();
var _users_table = undefined;
$.getJSON('{{ url_for("api.admin_me") }}').done(function (data) {
_me = data;
_users_table = $('#table-users').DataTable( {
{{ macros.translate_datatable() }}
{{ macros.get_page_length() }}
responsive: true,
processing: true,
fixedHeader: true,
select: {
style: 'os',
},
ajax: {
url: '{{ url_for("api.user_sessions") }}',
headers: { 'X-From-UI': true },
cache: AJAX_CACHE,
error: myFail,
data: function (request) {
request._extra = _cache_id;
},
dataSrc: function (data) {
return data;
}
},
});
});
......
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