Skip to content

Latest commit

 

History

History
60 lines (45 loc) · 1.49 KB

branch-restrictions.md

File metadata and controls

60 lines (45 loc) · 1.49 KB

Branch restrictions

Manage branch restrictions on a repository

Prepare:

$restrictions = new Bitbucket\API\Repositories\BranchRestrictions();
$restrictions->setCredentials(new Http\Message\Authentication\BasicAuth($bb_user, $bb_pass));

Get the information associated with a repository's branch restrictions: (API 2.0)

$restrictions->all($account_name, $repo_slug);

Creates restrictions: (API 2.0)

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')
    )
));

Get a specific restriction: (API 2.0)

$restrictions->get($account_name, $repo_slug, $restrictionID);

Update a specific restriction: (API 2.0)

$restrictions->update($account_name, $repo_slug, $restrictionID, array(
    'users' => array(
        array('username' => 'joe'),
        array('username' => 'mary'),
        array('username' => 'joe-work')
    )
));

Delete a specific restriction: (API 2.0)

$restrictions->delete($account_name, $repo_slug, $restrictionID);

Related: