Skip to content

Commit

Permalink
Add network_links to user post
Browse files Browse the repository at this point in the history
  • Loading branch information
zachhuff386 committed Oct 21, 2015
1 parent b6f7425 commit d3517b5
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions pritunl/handlers/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,17 @@
from pritunl import app
from pritunl import auth
from pritunl import mongo
from pritunl import ipaddress

import flask
import time

def _network_link_invalid():
return utils.jsonify({
'error': NETWORK_LINK_INVALID,
'error_msg': NETWORK_LINK_INVALID_MSG,
}, 400)

@app.app.route('/user/<org_id>', methods=['GET'])
@app.app.route('/user/<org_id>/<user_id>', methods=['GET'])
@app.app.route('/user/<org_id>/<int:page>', methods=['GET'])
Expand Down Expand Up @@ -190,6 +197,13 @@ def user_put(org_id, user_id):
if 'email' in flask.request.json:
user.email = utils.filter_str(flask.request.json['email']) or None

if 'network_links' in flask.request.json:
for network_link in flask.request.json['network_links']:
try:
user.add_network_link(network_link)
except ipaddress.AddressValueError:
return _network_link_invalid()

disabled = flask.request.json.get('disabled')
if disabled is not None:
user.disabled = disabled
Expand Down

0 comments on commit d3517b5

Please sign in to comment.