I see, we should stick with the original check for folderId.

In the case when PERMISSIONS_PARENT_INHERITANCE_BOOKMARKS_ENABLED is true, wouldn't we only need to check the top parent folder? Because whatever permissions it has should be inherited by all the children folders. If we have VIEW permission on the top parent folder, then we also have VIEW permission on all the children thereby preventing the need to check any of those folders. If we do not have VIEW permission on the top parent folder, then we return false because it does not meet the view dynamic inheritance requirement.

The while loop should stop right before the root folder, leaving us the top parent...unless I'm missing something?