mirror of
https://github.com/cwinfo/powerdns-admin.git
synced 2024-11-09 23:20:27 +00:00
feat: limit zone list for users on servers endpoint (#862)
This commit is contained in:
parent
dd0a5f6326
commit
718b41e3d1
@ -971,7 +971,15 @@ def api_get_zones(server_id):
|
|||||||
return jsonify(domain_schema.dump(domain_obj_list)), 200
|
return jsonify(domain_schema.dump(domain_obj_list)), 200
|
||||||
else:
|
else:
|
||||||
resp = helper.forward_request()
|
resp = helper.forward_request()
|
||||||
return resp.content, resp.status_code, resp.headers.items()
|
if (g.apikey.role.name not in ['Administrator', 'Operator']
|
||||||
|
and resp.status_code == 200):
|
||||||
|
domain_list = [d['name']
|
||||||
|
for d in domain_schema.dump(g.apikey.domains)]
|
||||||
|
content = json.dumps([i for i in json.loads(resp.content)
|
||||||
|
if i['name'].rstrip('.') in domain_list])
|
||||||
|
return content, resp.status_code, resp.headers.items()
|
||||||
|
else:
|
||||||
|
return resp.content, resp.status_code, resp.headers.items()
|
||||||
|
|
||||||
|
|
||||||
@api_bp.route('/servers', methods=['GET'])
|
@api_bp.route('/servers', methods=['GET'])
|
||||||
|
Loading…
Reference in New Issue
Block a user