6

I have created Coders User group with object level permission. Group is given Contributor permission for the project. When it comes to specific repository, I have applied object level permission- Like unable to delete a branch. When I verified it, the group is still able to see the Delete Branch option and they are able to delete it.

enter image description here

I have gone through Project Collection level permissions,Project permissions and Object level permissions. Even if we set Deny for Force Push, the group is able to use Delete branch option. So far, I have not seen an option to disable Delete branch option.

enter image description here

Has anyone set it before?

I am updating one more question here, regarding the New Folder in Pipeline. Is there a way to disable this as well for certain user group?

enter image description here

torek
  • 448,244
  • 59
  • 642
  • 775
Asterix
  • 331
  • 6
  • 22
  • I am suddenly unable to delete a branch that I created. As usual with MS web stuff the UI is woeful. I set the permission and it makes no difference. – AriesConnolly Jun 15 '23 at 23:05

2 Answers2

9

Regarding your first question about "Delete branch"

One way to achieve that is by setting branch policies. Please see below

enter image description here

ViBi
  • 515
  • 7
  • 19
  • Thank you @ViBi, I tested one branch with this and the setting didnt allow me to delete it. Thanks for the clarification – Asterix Sep 07 '21 at 05:00
  • Hi, it is still possible to delete the branch when completing the pull request, there is a "delete after merging checkbox". Is there another way to prevent branch deletion that would work everywhere ? – bN_ Jul 12 '22 at 07:55
1

For question 1 related to repo:

Based on my test, disabling the Force Push Permission indeed can block users deleting the branch.

Users can see the Delete Branch option, but when the user click the delete option, it will show the error message:

For example:

enter image description here

If the users in the Coders Group still can delete the branch, you may need to check the permission for Single user.

enter image description here

For question 1 related to Pipeline:

I am afraid that there is no specific permission to prevent users from deleting the Pipeline folder.

For a workaround, you can create or add an exising Pipeline to the folder and Deny the Delete Build Pipeline Permission.

enter image description here

enter image description here

Then the users will have no access to delete the folder.

Kevin Lu-MSFT
  • 20,786
  • 3
  • 19
  • 28