As a hub administrator, you can grant specific users the ability to create spokes
in other projects associated with the hub, and retain full control over which
spokes are accepted into the hub. Spokes do not become active until you
explicitly accept them. You can also reject spokes at any time, if necessary.

To grant another user the ability to create spokes in other projects associated
with the hub, you can grant the
`roles/networkconnectivity.groupUser` role to that user. A user with the
`groupUser` role on a hub automatically has the role on all groups in the hub
through the Identity and Access Management (IAM) resource hierarchy. As the hub
administrator, you can also revoke a user's access.

## Before you begin

Before you get started, review the following sections.

### Create or select a project

To make it easier to configure NCC, start by identifying a valid
project.

1. If you are using the Google Cloud CLI, set your project
   ID by using the
   [`gcloud config set` command](https://docs.cloud.google.com/sdk/gcloud/reference/config/set).

   ```
   gcloud config set project PROJECT_ID
   ```

   Replace `PROJECT_ID` with your unique project ID.

   The gcloud CLI instructions on this page assume that you have set your project ID.
2. To confirm that you set the project ID correctly, use the
   [`gcloud config list` command](https://docs.cloud.google.com/sdk/gcloud/reference/config/list).

   ```
   gcloud config list --format='text(core.project)'
   ```

### Enable the Network Connectivity API

Before you can perform *any* tasks using Network Connectivity Center (NCC), you must enable the
Network Connectivity API.

### Console

To enable the Network Connectivity API:

1. In the Google Cloud console, go to the **Network Connectivity Center** page.

   [Go to Network Connectivity Center](https://console.cloud.google.com/hybrid/hubs/list)
2. Click **Enable**.

Alternatively, you can enable the API by
using the
[Google Cloud console API Library](https://console.cloud.google.com/apis/library?project=_),
as described in [Enabling APIs](https://docs.cloud.google.com/apis/docs/getting-started#enabling_apis).

#### Permissions required for this task

To perform this task, you must have been granted the following permissions
*or* the following IAM roles.

**Permissions**

- `networkconnectivity.hubs.getIamPolicy`
- `networkconnectivity.hubs.setIamPolicy`

**Roles**

- `roles/networkconnectivity.hubAdmin`

## Manage access to create spokes in hubs across projects

The following sections describe how to grant, revoke, or view permissions to
create spokes in different projects than a hub.

### Grant the `groupUser` role on a hub to another user

To grant the `networkconnectivity.groupUser` role on a hub to another user,
follow these steps.

### Console

1. In the Google Cloud console, go to the **Network Connectivity Center** page.

   [Go to Network Connectivity Center](https://console.cloud.google.com/hybrid/hubs/list)
2. In the project menu, select a project.

3. Click the **Hubs** tab.

4. In the hubs list, select the hub to which you to add access.

5. Click **Permissions**.

6. In the **Permissions** dialog, click **Add principal**.

7. Enter the username of the administrator that you want to add.

8. In the **Manage roles** dialog, from the **Network Connectivity** roles list,
   select the role that you want to assign, such as **Spoke Admin**.

9. Click **Save**.

### gcloud

Run the
[`gcloud network-connectivity hubs add-iam-policy-binding` command](https://docs.cloud.google.com/sdk/gcloud/reference/network-connectivity/hubs/add-iam-policy-binding).

```
gcloud network-connectivity hubs add-iam-policy-binding HUB_NAME \
    --member=MEMBER_DETAILS \
    --role='roles/networkconnectivity.groupUser'

```

Replace the following:

- `HUB_NAME`: the hub for the spoke, such as `my-hub`.
- `MEMBER_DETAILS`: details about the user to whom you want to grant access. For detailed information about identifiers and format, see [Principal identifiers](https://docs.cloud.google.com/iam/docs/principal-identifiers#v1).

### Revoke the `groupUser` role on a hub from a user

To revoke the `roles/networkconnectivity.groupUser` role on a hub from a user,
follow these steps.

### gcloud

Run the
[`gcloud network-connectivity hubs remove-iam-policy-binding` command](https://docs.cloud.google.com/sdk/gcloud/reference/network-connectivity/hubs/remove-iam-policy-binding).

```
gcloud network-connectivity hubs remove-iam-policy-binding HUB_NAME \
    --member=MEMBER_DETAILS \
    --role='roles/networkconnectivity.groupUser'

```

Replace the following:

- `HUB_NAME`: the hub for the spoke, such as `my-hub`.
- `MEMBER_DETAILS`: details about the user that you want to remove access from. For detailed information about identifiers and format, see [Principal identifiers](https://docs.cloud.google.com/iam/docs/principal-identifiers#v1).

### View permissions for a user

To view permissions that have been granted to a user on a hub, follow these
steps.

### gcloud

Run the
[`gcloud network-connectivity hubs get-iam-policy` command](https://docs.cloud.google.com/sdk/gcloud/reference/network-connectivity/hubs/get-iam-policy).

```
gcloud network-connectivity hubs get-iam-policy HUB_NAME
```

Replace `HUB_NAME` with the name of the hub for which
you want to view permissions, such as `my-hub`.

## What's next

- To create hubs and spokes, see [Work with hubs and spokes](https://docs.cloud.google.com/network-connectivity/docs/network-connectivity-center/how-to/working-with-hubs-spokes).
- To view a list of partners whose solutions are integrated with NCC, see [NCC partners](https://docs.cloud.google.com/network-connectivity/docs/network-connectivity-center/partners).
- To find solutions for common issues, see [Troubleshooting](https://docs.cloud.google.com/network-connectivity/docs/network-connectivity-center/support/troubleshooting).
- To get details about API and `gcloud` commands, see [APIs and reference](https://docs.cloud.google.com/network-connectivity/docs/network-connectivity-center/apis).