##// END OF EJS Templates
API: update_user returns new updated user data
marcink -
r2507:374693af beta
parent child Browse files
Show More
@@ -273,7 +273,18 b' OUTPUT::'
273
273
274 result: {
274 result: {
275 "id" : "<edited_user_id>",
275 "id" : "<edited_user_id>",
276 "msg" : "updated user ID:<userid> <username>"
276 "msg" : "updated user ID:<userid> <username>",
277 "user": {
278 "id" : "<id>",
279 "username" : "<username>",
280 "firstname": "<firstname>",
281 "lastname" : "<lastname>",
282 "email" : "<email>",
283 "active" : "<bool>",
284 "admin" :  "<bool>",
285 "ldap_dn" : "<ldap_dn>",
286 "last_login": "<last_login>",
287 },
277 }
288 }
278 error: null
289 error: null
279
290
@@ -202,14 +202,25 b' class ApiController(JSONRPCController):'
202 raise JSONRPCError("user ID:%s does not exist" % userid)
202 raise JSONRPCError("user ID:%s does not exist" % userid)
203
203
204 try:
204 try:
205 usr = UserModel().create_or_update(
205 user = UserModel().create_or_update(
206 username, password, email, firstname,
206 username, password, email, firstname,
207 lastname, active, admin, ldap_dn
207 lastname, active, admin, ldap_dn
208 )
208 )
209 Session.commit()
209 Session.commit()
210 return dict(
210 return dict(
211 id=usr.user_id,
211 id=usr.user_id,
212 msg='updated user ID:%s %s' % (usr.user_id, usr.username)
212 msg='updated user ID:%s %s' % (user.user_id, user.username),
213 user=dict(
214 id=user.user_id,
215 username=user.username,
216 firstname=user.name,
217 lastname=user.lastname,
218 email=user.email,
219 active=user.active,
220 admin=user.admin,
221 ldap_dn=user.ldap_dn,
222 last_login=user.last_login,
223 )
213 )
224 )
214 except Exception:
225 except Exception:
215 log.error(traceback.format_exc())
226 log.error(traceback.format_exc())
General Comments 0
You need to be logged in to leave comments. Login now