##// END OF EJS Templates
user-groups-audit: properly link to user_group when doing api actions...
marcink -
r2107:ba9e03f0 default
parent child Browse files
Show More
@@ -464,6 +464,7 b' def add_user_to_user_group(request, apiu'
464 raise JSONRPCError('user group `%s` does not exist' % (
464 raise JSONRPCError('user group `%s` does not exist' % (
465 usergroupid,))
465 usergroupid,))
466
466
467 old_values = user_group.get_api_data()
467 try:
468 try:
468 ugm = UserGroupModel().add_user_to_group(user_group, user)
469 ugm = UserGroupModel().add_user_to_group(user_group, user)
469 success = True if ugm is not True else False
470 success = True if ugm is not True else False
@@ -474,7 +475,8 b' def add_user_to_user_group(request, apiu'
474 if success:
475 if success:
475 user_data = user.get_api_data()
476 user_data = user.get_api_data()
476 audit_logger.store_api(
477 audit_logger.store_api(
477 'user_group.edit.member.add', action_data={'user': user_data},
478 'user_group.edit.member.add',
479 action_data={'user': user_data, 'old_data': old_values},
478 user=apiuser)
480 user=apiuser)
479
481
480 Session().commit()
482 Session().commit()
@@ -534,6 +536,7 b' def remove_user_from_user_group(request,'
534 raise JSONRPCError(
536 raise JSONRPCError(
535 'user group `%s` does not exist' % (usergroupid,))
537 'user group `%s` does not exist' % (usergroupid,))
536
538
539 old_values = user_group.get_api_data()
537 try:
540 try:
538 success = UserGroupModel().remove_user_from_group(user_group, user)
541 success = UserGroupModel().remove_user_from_group(user_group, user)
539 msg = 'removed member `%s` from user group `%s`' % (
542 msg = 'removed member `%s` from user group `%s`' % (
@@ -543,7 +546,8 b' def remove_user_from_user_group(request,'
543 if success:
546 if success:
544 user_data = user.get_api_data()
547 user_data = user.get_api_data()
545 audit_logger.store_api(
548 audit_logger.store_api(
546 'user_group.edit.member.delete', action_data={'user': user_data},
549 'user_group.edit.member.delete',
550 action_data={'user': user_data, 'old_data': old_values},
547 user=apiuser)
551 user=apiuser)
548
552
549 Session().commit()
553 Session().commit()
General Comments 0
You need to be logged in to leave comments. Login now