Manage branch restrictions on a repository
$restrictions = new Bitbucket\API\Repositories\BranchRestrictions();
$restrictions->setCredentials(new Http\Message\Authentication\BasicAuth($bb_user, $bb_pass));
$restrictions->all($account_name, $repo_slug);
Restrict push access to any branches starting with joe-and-mary-
only to users joe
and mary
:
$restrictions->create($account_name, $repo_slug, array(
'kind' => 'push',
'pattern' => 'joe-and-mary-*',
'users' => array(
array('username' => 'joe'),
array('username' => 'mary')
)
));
$restrictions->get($account_name, $repo_slug, $restrictionID);
$restrictions->update($account_name, $repo_slug, $restrictionID, array(
'users' => array(
array('username' => 'joe'),
array('username' => 'mary'),
array('username' => 'joe-work')
)
));
$restrictions->delete($account_name, $repo_slug, $restrictionID);