mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
Normalizes non-standard code-fence language tags across `docs/**` so a strict highlighter (Shiki, used by Fumadocs) won't fail the build on an unrecognized language, and unifies redundant synonym tags onto one canonical form per language. The current renderer (Speed-Highlight) detects the language from the code content, not the fence label, so this drift wasn't visible until now. ## Changes - `hcl` -> `tf` (199 fences, including indented ones nested in numbered/bulleted lists). Shiki ships `hcl` and `terraform` as two distinct grammars (not aliases); every `hcl`-tagged fence in `docs/**` is actually Terraform resource/data/provider syntax, so the more specific `terraform` grammar is correct for all of them. `tf` is Shiki's own alias for that grammar, and it's also what GitHub's own markdown renderer resolves to the same HCL/Terraform highlighting. - `pwsh`/`powershell` -> `ps1`. Both `ps` and `ps1` are registered PowerShell aliases in Shiki, but on GitHub's renderer only `.ps1` is a registered file extension (`.ps` isn't), so `ps1` renders identically to `powershell` there today while bare `ps` would silently lose highlighting. - `env` -> `dotenv` (a dedicated Shiki grammar for `KEY=VALUE` files) - `text`/`output`/`none`/`url` -> `txt`. Same built-in plain-text fallback either way, just shorter. - `Dockerfile` -> `dockerfile` (lowercase) - `bash`/`shell` -> `sh` (732 fences). Shiki and GitHub both alias all three to a single shell grammar; this was already the style guide's stated preference, just not enforced across the existing corpus until now. - `markdown` -> `md` (4 fences). Alias of the same grammar in both Shiki and GitHub. - `jsonc` -> `json` (1 fence). The block has no comments or trailing commas, so it doesn't need the comments-capable grammar. - `ts` -> `tsx` (2 fences, `docs/about/contributing/frontend.md`). Verified the actual content tokenizes identically under both grammars, and a sibling block in the same file already needs `tsx` for real JSX, so unifying to one tag is safe for this file. Documented a caveat: `tsx` mis-tokenizes the legacy angle-bracket type-assertion syntax (`<Type>value`), which is invalid in real `.tsx` files anyway, so use `value as Type` instead. - `yml` -> `yaml` (1 fence) - Updated `docs/.style/style-guide/formatting.md` to document all canonical tags `promql` (2 fences) and `caddyfile` (2 fences) are left as-is. Shiki doesn't bundle a grammar for either, so they need a custom grammar registration when the site adopts Shiki, rather than degrading to `txt`. Tracked as follow-up work under DOCS-118 and [DOCS-544](https://linear.app/codercom/issue/DOCS-544/vendor-a-local-promql-grammar-for-shiki-syntax-highlighting) (promql). Does not touch `offlinedocs/`. Linear: [DOCS-476](https://linear.app/codercom/issue/DOCS-476/normalize-docs-code-fence-languages-de-risk-shikifumadocs) <details> <summary>How the fence tags were verified</summary> Each tag was tested against a real `shiki@latest` highlighter instance (`codeToHtml`/`codeToTokens`) and cross-checked against GitHub's `@wooorm/starry-night` grammar sources (the renderer that actually displays these `.md` files today, in repo browsing and PR diffs), since that's what determines whether brevity is safe before Shiki adoption: ```text FAIL env -- Language `env` is not included in this bundle. FAIL Dockerfile -- Language `Dockerfile` is not included in this bundle. FAIL promql -- Language `promql` is not included in this bundle. FAIL caddyfile -- Language `caddyfile` is not included in this bundle. FAIL pwsh -- Language `pwsh` is not included in this bundle. FAIL output -- Language `output` is not included in this bundle. ``` `hcl` doesn't error in Shiki, since it's a real grammar, but that's exactly the trap: it was silently rendering every fence with the generic HCL grammar instead of the Terraform-specific one. Every `hcl`-tagged fence in `docs/**` was manually checked against `origin/main` and is genuinely Terraform content. For `ts`/`tsx`, tokenizing the actual doc content confirmed identical output under both grammars; a synthetic test with the legacy angle-bracket cast syntax confirmed `tsx` degrades on that specific construct, which the style guide now calls out. The first normalization pass only matched fence tags at column 0 (`^```tag$`), missing tags indented inside numbered/bulleted lists. A follow-up pass caught the remaining occurrences at any indentation level. </details> --- *This PR description and the underlying changes were prepared with Coder Agents assistance.*
263 lines
8.4 KiB
Markdown
263 lines
8.4 KiB
Markdown
# Users
|
|
|
|
By default, Coder is accessible via password authentication. For production
|
|
deployments, we recommend using an SSO authentication provider with multi-factor
|
|
authentication (MFA). It is your responsibility to ensure the auth provider
|
|
enforces MFA correctly.
|
|
|
|
## Configuring SSO
|
|
|
|
- [OpenID Connect](./oidc-auth/index.md) (e.g. Okta, KeyCloak, PingFederate, Azure AD)
|
|
- [GitHub](./github-auth.md) (or GitHub Enterprise)
|
|
|
|
## Groups
|
|
|
|
Multiple users can be organized into logical groups to control which templates
|
|
they can use. While groups can be manually created in Coder, we recommend
|
|
syncing them from your identity provider.
|
|
|
|
- [Learn more about Groups](./groups-roles.md)
|
|
- [Group & Role Sync](./idp-sync.md)
|
|
|
|
## Roles
|
|
|
|
Roles determine which actions users can take within the platform. Typically,
|
|
most developers in your organization have the `Member` role, allowing them to
|
|
create workspaces. Other roles have administrative capabilities such as
|
|
auditing, managing users, and managing templates.
|
|
|
|
- [Learn more about Roles](./groups-roles.md)
|
|
- [Group & Role Sync](./idp-sync.md)
|
|
|
|
## User status
|
|
|
|
Coder user accounts can have different status types: active, dormant, and
|
|
suspended.
|
|
|
|
### Active user
|
|
|
|
An _active_ user account in Coder is the default and desired state for all
|
|
users. When a user's account is marked as _active_, they have complete access to
|
|
the Coder platform and can utilize all of its features and functionalities
|
|
without any limitations. Active users can access workspaces, templates, and
|
|
interact with Coder using CLI.
|
|
|
|
### Dormant user
|
|
|
|
A user account is set to _dormant_ status when they have not yet logged in, or
|
|
have not logged into the Coder platform for the past 90 days. Once the user logs
|
|
in to the platform, the account status will switch to _active_.
|
|
|
|
Dormant accounts do not count towards the total number of licensed seats in a
|
|
Coder subscription, allowing organizations to optimize their license usage.
|
|
|
|
### Suspended user
|
|
|
|
When a user's account is marked as _suspended_ in Coder, it means that the
|
|
account has been temporarily deactivated, and the user is unable to access the
|
|
platform.
|
|
|
|
Only user administrators or owners have the necessary permissions to manage
|
|
suspended accounts and decide whether to lift the suspension and allow the user
|
|
back into the Coder environment. This level of control ensures that
|
|
administrators can enforce security measures and handle any compliance-related
|
|
issues promptly.
|
|
|
|
Similar to dormant users, suspended users do not count towards the total number
|
|
of licensed seats.
|
|
|
|
## Create a user
|
|
|
|
To create a user with the web UI:
|
|
|
|
1. Log in as a user admin.
|
|
2. Go to **Users** > **New user**.
|
|
3. In the window that opens, provide the **username**, **email**, and
|
|
**password** for the user (they can opt to change their password after their
|
|
initial login).
|
|
4. Click **Submit** to create the user.
|
|
|
|
The new user will appear in the **Users** list. Use the toggle to change their
|
|
**Roles** if desired.
|
|
|
|
To create a user via the Coder CLI, run:
|
|
|
|
```sh
|
|
coder users create
|
|
```
|
|
|
|
When prompted, provide the **username** and **email** for the new user.
|
|
|
|
You'll receive a response that includes the following; share the instructions
|
|
with the user so that they can log into Coder:
|
|
|
|
```console
|
|
Download the Coder command line for your operating system:
|
|
https://github.com/coder/coder/releases/latest
|
|
|
|
Run coder login https://<accessURL>.coder.app to authenticate.
|
|
|
|
Your email is: email@exampleCo.com
|
|
Your password is: <redacted>
|
|
|
|
Create a workspace coder create !
|
|
```
|
|
|
|
## Suspend a user
|
|
|
|
User admins can suspend a user, removing the user's access to Coder.
|
|
|
|
To suspend a user via the web UI:
|
|
|
|
1. Go to **Users**.
|
|
2. Find the user you want to suspend, click the vertical ellipsis to the right,
|
|
and click **Suspend**.
|
|
3. In the confirmation dialog, click **Suspend**.
|
|
|
|
To suspend a user via the CLI, run:
|
|
|
|
```sh
|
|
coder users suspend <username|user_id>
|
|
```
|
|
|
|
Confirm the user suspension by typing **yes** and pressing **enter**.
|
|
|
|
## Activate a suspended user
|
|
|
|
User admins can activate a suspended user, restoring their access to Coder.
|
|
|
|
To activate a user via the web UI:
|
|
|
|
1. Go to **Users**.
|
|
2. Find the user you want to activate, click the vertical ellipsis to the right,
|
|
and click **Activate**.
|
|
3. In the confirmation dialog, click **Activate**.
|
|
|
|
To activate a user via the CLI, run:
|
|
|
|
```sh
|
|
coder users activate <username|user_id>
|
|
```
|
|
|
|
Confirm the user activation by typing **yes** and pressing **enter**.
|
|
|
|
## Reset a password
|
|
|
|
As of 2.17.0, users can reset their password independently on the login screen
|
|
by clicking "Forgot Password." This feature requires
|
|
[email notifications](../monitoring/notifications/index.md#smtp-email) to be
|
|
configured on the deployment.
|
|
|
|
To reset a user's password as an administrator via the web UI:
|
|
|
|
1. Go to **Users**.
|
|
2. Find the user whose password you want to reset, click the vertical ellipsis
|
|
to the right, and select **Reset password**.
|
|
3. Coder displays a temporary password that you can send to the user; copy the
|
|
password and click **Reset password**.
|
|
|
|
Coder will prompt the user to change their temporary password immediately after
|
|
logging in.
|
|
|
|
You can also reset a password via the CLI:
|
|
|
|
```sh
|
|
# run `coder reset-password <username> --help` for usage instructions
|
|
coder reset-password <username>
|
|
```
|
|
|
|
> [!NOTE]
|
|
> Resetting a user's password, e.g., the initial `owner` role-based user, only
|
|
> works when run on the host running the Coder control plane.
|
|
|
|
### Resetting a password on Kubernetes
|
|
|
|
```sh
|
|
kubectl exec -it deployment/coder -n coder -- /bin/bash
|
|
|
|
coder reset-password <username>
|
|
```
|
|
|
|
## User filtering
|
|
|
|
In the Coder UI, you can filter your users using pre-defined filters or by
|
|
utilizing the Coder's filter query. The examples provided below demonstrate how
|
|
to use the Coder's filter query:
|
|
|
|
- To find active users, use the filter `status:active`.
|
|
- To find admin users, use the filter `role:admin`.
|
|
- To find users who have not been active since July 2023:
|
|
`status:active last_seen_before:"2023-07-01T00:00:00Z"`
|
|
- To find users who were created between January 1 and January 18, 2023:
|
|
`created_before:"2023-01-18T00:00:00Z" created_after:"2023-01-01T23:59:59Z"`
|
|
- To find users who login using Github:
|
|
`login_type:github`
|
|
- To find service accounts: `service_account:true`.
|
|
|
|
The following filters are supported:
|
|
|
|
- `status` - Indicates the status of the user. It can be either `active`,
|
|
`dormant` or `suspended`.
|
|
- `role` - Represents the role of the user. You can refer to the
|
|
[TemplateRole documentation](https://pkg.go.dev/github.com/coder/coder/v2/codersdk#TemplateRole)
|
|
for a list of supported user roles.
|
|
- `last_seen_before` and `last_seen_after` - The last time a user has used the
|
|
platform (e.g. logging in, any API requests, connecting to workspaces). Uses
|
|
the RFC3339Nano format.
|
|
- `created_before` and `created_after` - The time a user was created. Uses the
|
|
RFC3339Nano format.
|
|
- `login_type` - Represents the login type of the user. Refer to the [LoginType documentation](https://pkg.go.dev/github.com/coder/coder/v2/codersdk#LoginType) for a list of supported values
|
|
- `service_account` - Can be either `true` to only include service accounts or
|
|
`false` to filter them out. If omitted, both service and regular accounts and
|
|
are returned.
|
|
|
|
## Edit a user's profile
|
|
|
|
To edit a user's display name or username with the web UI:
|
|
|
|
1. Log in as a user admin.
|
|
2. Go to **Users**
|
|
3. Find the user whose details you would like to edit
|
|
4. Select **Edit** from the actions menu
|
|
5. Make any desired changes
|
|
6. Click **Save**
|
|
|
|
## Retrieve your list of Coder users
|
|
|
|
<div class="tabs">
|
|
|
|
You can use the Coder CLI or API to retrieve your list of users.
|
|
|
|
### CLI
|
|
|
|
Use `users list` to export the list of users to a CSV file:
|
|
|
|
```sh
|
|
coder users list > users.csv
|
|
```
|
|
|
|
Visit the [users list](../../reference/cli/users_list.md) documentation for more options.
|
|
|
|
### API
|
|
|
|
Use [get users](../../reference/api/users.md#get-users):
|
|
|
|
```sh
|
|
curl -X GET http://coder-server:8080/api/v2/users \
|
|
-H 'Accept: application/json' \
|
|
-H 'Coder-Session-Token: API_KEY'
|
|
```
|
|
|
|
To export the results to a CSV file, you can use [`jq`](https://jqlang.org/) to process the JSON response:
|
|
|
|
```sh
|
|
curl -X GET http://coder-server:8080/api/v2/users \
|
|
-H 'Accept: application/json' \
|
|
-H 'Coder-Session-Token: API_KEY' | \
|
|
jq -r '.users | (map(keys) | add | unique) as $cols | $cols, (.[] | [.[$cols[]]] | @csv)' > users.csv
|
|
```
|
|
|
|
Visit the [get users](../../reference/api/users.md#get-users) documentation for more options.
|
|
|
|
</div>
|