Prevent the user attempting to run external commands if the bin path is not configured. Fixes #1177

This commit is contained in:
Harshal Dhumal
2016-08-08 11:59:37 +01:00
committed by Dave Page
parent 8e099e29c3
commit f78024808e
7 changed files with 265 additions and 12 deletions

View File

@@ -82,18 +82,37 @@ def script():
@blueprint.route("/preferences", methods=["GET"])
@blueprint.route("/preferences/<module>/<preference>")
@login_required
def preferences():
"""Fetch all the preferences of pgAdmin IV."""
def preferences(module=None, preference=None):
"""Fetch all/or requested preferences of pgAdmin IV."""
if module is not None and preference is not None:
try:
m = Preferences.module(module, create=False)
if m is None:
return Response(status=404)
p = m.preference(preference)
if p is None:
return Response(status=404)
return ajax_response(
response=p.to_json(),
status=200
)
except Exception as e:
return internal_server_error(errormsg=str(e))
# Load Preferences
preferences = Preferences.preferences()
pref = Preferences.preferences()
res = []
def label(p):
return p['label']
for m in preferences:
for m in pref:
if len(m['categories']):
om = {
"id": m['id'],