@@ -283,6 +283,40 @@ def remove_folder_key(self, uid: str, folder_type: str, key: str, owner_key: str
283283
284284 self ._update_user_column (uid , tbl .COL_USER_FOLDERS .name , current_folders )
285285
286+ def update_folder_value (self , uid : str , resource : str , folder_id : str , value : bool ) -> dict :
287+ """
288+ Update the boolean value of a single folder key within the folders column (CALENDAR or ADDRESSBOOKS).
289+
290+ Searches every owner-type sub-section (OWNER, SUBS, EXT, ...) of the given resource for folder_id
291+ and updates the first match found; folder_id is expected to be unique across the whole structure.
292+
293+ :param uid: User unique identifier
294+ :type uid: str
295+ :param resource: Resource type - "CALENDAR" or "ADDRESSBOOKS"
296+ :type resource: str
297+ :param folder_id: Unique id of the folder to update
298+ :type folder_id: str
299+ :param value: New boolean value to set
300+ :type value: bool
301+ :return: The updated folders dictionary
302+ :rtype: dict
303+ :raises RequestException: If user profile not found or folder_id not found for this resource
304+ :raises AggravatedException: If multiple user profiles found
305+ """
306+ logger_user_profile .debug ("Updating folder value for uid: %s, resource: %s, id: %s, value: %s" ,
307+ uid , resource , folder_id , value )
308+
309+ current_folders = self ._get_user_column (uid , tbl .COL_USER_FOLDERS .name )
310+
311+ for section in current_folders .get (resource , {}).values ():
312+ if folder_id in section :
313+ section [folder_id ] = value
314+ self ._update_user_column (uid , tbl .COL_USER_FOLDERS .name , current_folders )
315+ return current_folders
316+
317+ logger_user_profile .error ("Folder key not found for uid: %s, resource: %s, id: %s" , uid , resource , folder_id )
318+ raise RequestException (err .ERROR_FOLDER_KEY_NOT_FOUND .m , err .ERROR_FOLDER_KEY_NOT_FOUND )
319+
286320 def _get_user_column (self , uid : str , field_name : str ) -> Any :
287321 """
288322 Generic method to get a specific field from user profile
0 commit comments