PHP Bitbucket API

Simple Bitbucket API wrapper for PHP

Privileges

Manage the user privileges (permissions) of your repositories. It allows you to grant specific users access to read, write and or administer your repositories.

Prepare

// @see: https://bitbucket.org/account/user/<username or team>/api
$oauth_params = array(
    'client_id'         => 'aaa',
    'client_secret'     => 'bbb'
);

$privileges = new \Bitbucket\API\Privileges();
$privileges->getClient()->addListener(
    new \Bitbucket\API\Http\Listener\OAuth2Listener($oauth_params)
);

Get a list of user privileges granted on a repository with read access.

$privileges->repository($owner_name, $repo_slug, 'read');

Get privileges for an individual.

$privileges->account($owner_name, $repo_slug, $account_name);

Get a list of all privileges across all an account's repositories with write access.

$privileges->repositories($owner_name, 'write');

Grants an account admin privilege on a repository.

$privileges->grant($owner_name, $repo_slug, $account_name, 'admin');

Delete account privileges from a repository.

$privileges->detele($owner_name, $repo_slug, $account_name);

Delete all privileges from a repository

$privileges->detele($owner_name, $repo_slug);

Delete all privileges from all repositories

$privileges->detele($owner_name);