Using Group/Ungroup in protected worksheets

You would have to use a Workbook_Open macro to set the protection a special way when you open the workbook.

The following needs to go in the ThisWorkbook module. The password is password – you can change the text between the quotation marks to what you need it to be. The sheet with the subtotaling is called sales – you can change that below.
Private Sub Workbook_Open()
With Worksheets("sales")
.Protect Password:="password", Userinterfaceonly:=True
.EnableOutlining = True
End With
End Sub