|
@ -83,7 +83,7 @@ def get_user(user, user_name): |
|
|
@requires_same_user_or_admin_auth |
|
|
@requires_same_user_or_admin_auth |
|
|
def update_user(user, user_name): |
|
|
def update_user(user, user_name): |
|
|
new_lilik_user = request.get_json() |
|
|
new_lilik_user = request.get_json() |
|
|
app.logger.info('User <{}> editing user <{}>'.format(user.id, user_name)) |
|
|
|
|
|
|
|
|
app.logger.info('User <{}> editing user <{}>'.format(user.uid, user_name)) |
|
|
user_to_edit = lilik_ldap.get_user(user_name) |
|
|
user_to_edit = lilik_ldap.get_user(user_name) |
|
|
diff = user_to_edit.diff(new_lilik_user) |
|
|
diff = user_to_edit.diff(new_lilik_user) |
|
|
is_permitted_self_changes = diff.changed() <= set(['cn']) and diff.removed() == set() and diff.added() <= set(['userPassword']) |
|
|
is_permitted_self_changes = diff.changed() <= set(['cn']) and diff.removed() == set() and diff.added() <= set(['userPassword']) |
|
@ -95,7 +95,7 @@ def update_user(user, user_name): |
|
|
@requires_auth |
|
|
@requires_auth |
|
|
@requires_admin_auth |
|
|
@requires_admin_auth |
|
|
def new_user(user): |
|
|
def new_user(user): |
|
|
app.logger.info('User <{}> create a new user'.format(user.id)) |
|
|
|
|
|
|
|
|
app.logger.info('User <{}> create a new user'.format(user.uid)) |
|
|
new_lilik_user = request.get_json() |
|
|
new_lilik_user = request.get_json() |
|
|
app.logger.info(lilik_ldap.new_user(new_lilik_user)) |
|
|
app.logger.info(lilik_ldap.new_user(new_lilik_user)) |
|
|
return jsonify(lilik_ldap.get_user(new_lilik_user['uid']).to_dict()) |
|
|
return jsonify(lilik_ldap.get_user(new_lilik_user['uid']).to_dict()) |
|
|