v7.2.5.0: Refactor execution of group changes in user settings

This commit streamlines the way user group data is handled, both in scripts and server-side logic. The group settings URL has been simplified and the logic for updating user groups also has been optimized. Eliminated unnecessary checks in the user.py module, and updated the routing logic for group data to utilize a single route with HTTP GET and PUT methods. Removed unsuccessful group changing errors.
This commit is contained in:
Aidaho
2024-05-15 21:35:38 +03:00
parent 88471af613
commit c56d105ef5
4 changed files with 20 additions and 30 deletions

View File

@@ -98,12 +98,10 @@ def change_user_services(user: str, user_id: int, user_services: str) -> str:
def change_user_active_group(group_id: int, user_uuid: str) -> str:
try:
if user_sql.update_user_current_groups(group_id, user_uuid):
return 'Ok'
else:
return 'error: Cannot change group'
user_sql.update_user_current_groups(group_id, user_uuid)
return 'Ok'
except Exception as e:
return f'error: Cannot change the group: {e}'
roxywi_common.handle_exceptions(e, 'Roxy-WI server', 'Cannot change the group', roxywi=1, login=1)
def get_user_active_group(uuid: str, group: str) -> str: