MCPcopy Create free account
hub / github.com/pgadmin-org/pgadmin4 / update_role

Function update_role

web/pgadmin/tools/user_management/__init__.py:369–390  ·  view source on GitHub ↗
(rid, data)

Source from the content-addressed store, hash-verified

367
368
369def update_role(rid, data):
370 try:
371 validate_unique_role(data)
372 r = Role.query.get(rid)
373
374 if not r:
375 return ajax_response(
376 response=_('Role not found'),
377 status=404
378 )
379
380 for key, value in data.items():
381 setattr(r, key, value)
382
383 db.session.commit()
384 return ajax_response(
385 status=200
386 )
387 except Exception as e:
388 db.session.rollback()
389 current_app.logger.exception(e)
390 return internal_server_error(str(e))
391
392
393def delete_role(rid):

Callers 1

role_saveFunction · 0.85

Calls 3

internal_server_errorFunction · 0.90
validate_unique_roleFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected