A lot of times we come across situations where we need to use the Grouping / Outlining feature in Excel, but at the same time we want to protect the sheet too. Excel doesn't provide an option to do this via the sheet protection window that pops up while protecting a sheet. However, this can easily be achieved using VBA. Here's how (paste it in a module)

Code:
Private Sub Auto_Open()

    Dim wks As Worksheet
    
    For Each wks In Worksheets
        With wks
           .Protect Password:="YourPassWordHERE", UserInterfaceOnly:=True
           .EnableOutlining = True
        End With
    Next wks

End Sub