Access control in Google Cloud is controlled using
[Identity and Access Management](https://docs.cloud.google.com/iam)
(IAM). IAM allows you to set permissions
specifying **who** has **what** kind of access to **which** resources in your
project.

Cloud Source Repositories uses IAM for access control. You can use
IAM to add team members to your project and to grant them
permissions to create, view, and update repositories.

This page describes the IAM permissions and roles that apply to
Cloud Source Repositories.

## Permissions

With IAM, every action on a repository in Cloud Source Repositories
requires that the account initiating the action has the appropriate permissions.
You don't grant specific permissions to an account. Instead, you grant a role
that contains the appropriate set of permissions.

The following table describes the permissions available in
Cloud Source Repositories.

| Permission | Description |
|---|---|
| `source.repos.list` | List repositories within a project. |
| `source.repos.create` | Create a repository within a project. |
| `source.repos.get` | Clone, fetch, and browse repositories. |
| `source.repos.update` | Push changes to a repository. |
| `source.repos.updateRepoConfig` | Change a repository configuration. |
| `source.repos.delete` | Delete a repository. |
| `source.repos.getIamPolicy` | Read/view the IAM policy of a repository. |
| `source.repos.setIamPolicy` | Change the IAM policy of a repository. |
| `source.repos.getProjectConfig` | Read/view the Google Cloud project configuration. |
| `source.repos.updateProjectConfig` | Change the Google Cloud project configuration. |

## Roles

You assign permissions to accounts through the use of roles. The following table
lists the roles available for Cloud Source Repositories.

| Role | Role Title |
|---|---|
| `roles/source.reader` | Source Repository Reader |
| `roles/source.writer` | Source Repository Writer |
| `roles/source.admin` | Source Repository Administrator |

## Roles and permissions matrix

Use the table below to select the appropriate role for an account based on the
types of actions you want that account to perform.

| Capability | [`reader`](https://docs.cloud.google.com/source-repositories/docs/configure-access-control.md.txt#source.reader) | [`writer`](https://docs.cloud.google.com/source-repositories/docs/configure-access-control.md.txt#source.writer) | [`admin`](https://docs.cloud.google.com/source-repositories/docs/configure-access-control.md.txt#bigq) |
|---|---|---|---|
| List repositories | Yes | Yes | Yes |
| Clone, fetch, and browse repositories | Yes | Yes | Yes |
| Update repositories | No | Yes | Yes |
| Create repositories | No | No | Yes |
| Update repository configurations | No | No | Yes |
| Delete repositories | No | No | Yes |
| View IAM policies | No | No | Yes |
| Set IAM policies | No | No | Yes |
| View Google Cloud project configurations | No | No | Yes |
| Update Google Cloud project configurations | No | No | Yes |

## Custom roles

In addition to the predefined roles, Cloud Source Repositories also supports custom
roles. For more information, see
[Creating and managing custom roles](https://docs.cloud.google.com/iam/docs/creating-custom-roles.md.txt)
in the IAM documentation.

> [!NOTE]
> **Note:** The `source.repos.update` permission cannot be granted to a custom role.

## Granting principals access

In IAM, you grant access to **principals** . There are multiple types
of principals. For a complete list, see
[Principal types](https://docs.cloud.google.com/iam/docs/principals-overview.md.txt#principal-types).

For specific steps on granting member access, see
[Granting, changing, and revoking access to resources](https://docs.cloud.google.com/iam/docs/granting-changing-revoking-access.md.txt).

You can't make a Google Cloud repository public. As a result,
Cloud Source Repositories doesn't support the following member types:

- allAuthenticatedUsers
- allUsers