# swb customers

Where a product's customers are created. **Shared** puts each customer in the
org's Customers branch, where one outside company is one account that every
Willdan product inviting it reuses; **isolated** creates each customer under
the product's own account. With neither flag the command shows the setting;
with one it sets it.

A change governs invitations from then on. It moves no customer already
invited — Frontegg publishes no call that moves an account — and the command
says so after a change.

## Synopsis

```
usage: swb customers <app> [--shared | --isolated] [--json]
```

## Arguments and flags

| Argument or flag | Takes | Default |
|---|---|---|
| `<app>` | The app's **id**. Required. | — |
| `--shared` | Nothing. Each customer is one account in the org's Customers branch. | — |
| `--isolated` | Nothing. Each customer is created under the app's own account. | — |
| `--json` | Nothing. Prints the setting as the API answered it instead of the sentence. | off |
| `--help`, `-h` | Prints the command's help and exits. | off |

Giving neither setting shows the one in force; giving both is refused. An app
that has never set it is shared, which is the default.

## What it prints

One sentence naming the app and what its setting does. After a change, a
second line saying what the setting governs: customer invitations from now on,
with every customer already invited left where it is.

`--json` prints `app` and `customers` on a read, and the act's answer —
`app`, `customers` and `governs` — on a change.

## The operation and the permission

`Query.app` to show it and `Mutation.setCustomerSharing` to set it. Setting it
needs `swb.publishing.write`, and only the tenant that **owns** the app sets
it: the owner is the app's catalog row's own, which the repository scan writes.
`swb customers` also reads `Query.me` once for the tenant.

## The same act in the console

An app's page → **Settings** → *Access*: *Customers — shared across Willdan
products* or *isolated to this product*.

## Refusals and exit status

Exit status is 0 on success and 1 on every refusal below.

| Refusal | When |
|---|---|
| `swb customers takes <app>` | The app is missing. |
| `--shared and --isolated are the two settings; give one, not both` | Both were given. |
| `the catalog carries no app named <app>` | No app has that id. |
| `not signed in or token expired — run swb login` | There is no usable credential. |
| The API's own error text | The control plane refused — a caller who is not the app's owner, for example. |

## Example

```console
$ swb customers loadseer --isolated
loadseer's customers are isolated: each is created under loadseer's own account
It governs customer invitations from now on; every customer already invited stays where it is, because Frontegg publishes no call that moves an account.
```
