Bitbucket branch restrictions allow you to control the actions users can perform on a single branch, branch type, or branch pattern within a repository. Branch restrictions provide another level of security within Bitbucket Server, along with user authentication and project, repository and global permissions, that together allow you to control, or enforce, your own workflow or process.
bitbucket_branch_restriction table can be used to query issues belonging to a repository, and you must specify which repository with
where repository_full_name='workspace/repository'. Also you must have admin access to the repository in order to access the branch restrictions.
List the branch restrictions in a repository
selectrepository_full_name,id,self_link,kind,value,typefrombitbucket_branch_restrictionwhererepository_full_name = 'sayan97tb/stmp-rep';
List the branch restrictions having pattern for branch names
selectrepository_full_name,id,self_link,patternfrombitbucket_branch_restrictionwhererepository_full_name = 'sayan97tb/stmp-rep'and pattern = 'test-*';
List the branch restrictions associated with a specific user
selectrepository_full_name,id,self_link,pattern,u ->> 'display_name' as user_namefrombitbucket_branch_restriction,jsonb_array_elements(users) as uwhererepository_full_name = 'sayan97tb/stmp-rep'and u ->> 'display_name' = 'sayan';
List the branch restrictions having 'branching_model' branch_match_kind
selectrepository_full_name,id,self_link,pattern,branch_match_kindfrombitbucket_branch_restrictionwhererepository_full_name = 'sayan97tb/stmp-rep'and branch_match_kind = 'branching_model';
Branch restrictions allow you to control the actions users can perform on a single branch, branch type, or branch pattern within a repository.
|branch_match_kind||text||The Branch match kind for the branch restriction.|
|branch_type||text||The type of branch selected while creating the branch restriction.|
|groups||jsonb||Details of the groups associated with the branch restriction.|
|id||bigint||The unique ID if the branch restriction.|
|kind||text||The type of restriction achieved using the branch restriction.|
|pattern||text||The branch name pattern specified while creating the branch restriction.|
|repository_full_name||text||The repository's full name.|
|self_link||text||The URL to the branch restriction.|
|title||text||Title of the resource.|
|type||text||The type of the branch operation.|
|users||jsonb||Details of the users associated with the branch restriction.|
|value||bigint||The value associated to the kind for the branch restriction.|