Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
a3fbe72
docs: audit, deploymentconfig, files, parameters
mtojek Dec 22, 2022
fbe1d70
Swagger comments in workspacebuilds.go
mtojek Jan 2, 2023
96daf47
structs in workspacebuilds.go
mtojek Jan 2, 2023
663ec87
workspaceagents: instance identity
mtojek Jan 2, 2023
fc00d7e
workspaceagents.go in progress
mtojek Jan 2, 2023
67a85b9
workspaceagents.go in progress
mtojek Jan 2, 2023
ce8c7ea
Agents
mtojek Jan 2, 2023
d2a9af5
workspacebuilds.go
mtojek Jan 2, 2023
f37c6b3
/workspaces
mtojek Jan 3, 2023
250982a
templates.go, templateversions.go
mtojek Jan 3, 2023
ff622a7
templateversion.go in progress
mtojek Jan 3, 2023
9dd385c
cancel
mtojek Jan 3, 2023
f96351a
templateversions
mtojek Jan 3, 2023
15de3b6
wip
mtojek Jan 3, 2023
596cdbd
Merge branch 'main' into 3522-workspacebuilds-1
mtojek Jan 3, 2023
eb4ba48
Merge
mtojek Jan 3, 2023
e314c24
x-apidocgen
mtojek Jan 4, 2023
97cd7ac
NullTime hack not needed anymore
mtojek Jan 4, 2023
ae06598
Fix: x-apidocgen
mtojek Jan 4, 2023
c82eb01
Merge branch '3522-workspacebuilds-1' into 3522-templates-1
mtojek Jan 4, 2023
77815d3
Merge branch '3522-templates-1' into 3522-organizations-1
mtojek Jan 4, 2023
7aa0f65
Members
mtojek Jan 4, 2023
b93398e
Fixes
mtojek Jan 4, 2023
5c96bd5
Fix
mtojek Jan 4, 2023
4667f07
WIP
mtojek Jan 5, 2023
0cd9c4a
Merge branch 'main' into 3522-templates-1
mtojek Jan 5, 2023
5405c0c
WIP
mtojek Jan 9, 2023
801cad1
Merge branch '3522-users-1' into 3522-organizations-1
mtojek Jan 9, 2023
0dc1d2a
Users
mtojek Jan 9, 2023
9285425
Logout
mtojek Jan 9, 2023
6979a7f
User profile
mtojek Jan 9, 2023
62a26f9
Status suspend activate
mtojek Jan 9, 2023
b1f389b
User roles
mtojek Jan 9, 2023
14a1654
User tokens
mtojek Jan 9, 2023
5c22629
Keys
mtojek Jan 9, 2023
91c78f4
SSH key
mtojek Jan 9, 2023
c06a636
All
mtojek Jan 9, 2023
ee6dbb1
Typo
mtojek Jan 9, 2023
8f22f8d
Fix
mtojek Jan 9, 2023
77be926
Entitlements
mtojek Jan 9, 2023
4fcedb0
Groups
mtojek Jan 9, 2023
35eae4e
SCIM
mtojek Jan 9, 2023
a7f6add
Fix
mtojek Jan 9, 2023
0f9b0f6
Merge branch 'main' into 3522-enterprise-1
mtojek Jan 9, 2023
3ecfad7
Fix
mtojek Jan 9, 2023
05b6a98
Clean templates
mtojek Jan 9, 2023
03d9e9a
Merge branch 'main' into 3522-enterprise-1
mtojek Jan 11, 2023
1ebf408
Sort API pages
mtojek Jan 11, 2023
c2977cf
Fix: HashedSecret
mtojek Jan 11, 2023
000b890
General is first
mtojek Jan 11, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Logout
  • Loading branch information
mtojek committed Jan 9, 2023
commit 928542560f56a60be96e263cb4dc48f873ba6ca0
53 changes: 53 additions & 0 deletions coderd/apidoc/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -2029,6 +2029,31 @@ const docTemplate = `{
}
}
},
"/users/logout": {
"post": {
"security": [
{
"CoderSessionToken": []
}
],
"produces": [
"application/json"
],
"tags": [
"Users"
],
"summary": "Log out user",
"operationId": "log-out-user",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/codersdk.Response"
}
}
}
}
},
"/users/oauth2/github/callback": {
"get": {
"security": [
Expand Down Expand Up @@ -2073,6 +2098,34 @@ const docTemplate = `{
}
}
},
"/users/roles": {
"get": {
"security": [
{
"CoderSessionToken": []
}
],
"produces": [
"application/json"
],
"tags": [
"Members"
],
"summary": "Get site member roles",
"operationId": "get-site-member-roles",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/codersdk.AssignableRoles"
}
}
}
}
}
},
"/users/{user}/workspace/{workspacename}": {
"get": {
"security": [
Expand Down
45 changes: 45 additions & 0 deletions coderd/apidoc/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -1785,6 +1785,27 @@
}
}
},
"/users/logout": {
"post": {
"security": [
{
"CoderSessionToken": []
}
],
"produces": ["application/json"],
"tags": ["Users"],
"summary": "Log out user",
"operationId": "log-out-user",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/codersdk.Response"
}
}
}
}
},
"/users/oauth2/github/callback": {
"get": {
"security": [
Expand Down Expand Up @@ -1821,6 +1842,30 @@
}
}
},
"/users/roles": {
"get": {
"security": [
{
"CoderSessionToken": []
}
],
"produces": ["application/json"],
"tags": ["Members"],
"summary": "Get site member roles",
"operationId": "get-site-member-roles",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/codersdk.AssignableRoles"
}
}
}
}
}
},
"/users/{user}/workspace/{workspacename}": {
"get": {
"security": [
Expand Down
12 changes: 10 additions & 2 deletions coderd/roles.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ import (
)

// assignableSiteRoles returns all site wide roles that can be assigned.
//
// @Summary Get site member roles
// @ID get-site-member-roles
// @Security CoderSessionToken
// @Produce json
// @Tags Members
// @Success 200 {array} codersdk.AssignableRoles
// @Router /users/roles [get]
func (api *API) assignableSiteRoles(rw http.ResponseWriter, r *http.Request) {
ctx := r.Context()
actorRoles := httpmw.UserAuthorization(r)
Expand All @@ -23,6 +31,8 @@ func (api *API) assignableSiteRoles(rw http.ResponseWriter, r *http.Request) {
httpapi.Write(ctx, rw, http.StatusOK, assignableRoles(actorRoles.Roles, roles))
}

// assignableSiteRoles returns all org wide roles that can be assigned.
//
// @Summary Get member roles by organization
// @ID get-member-roles-by-organization
// @Security CoderSessionToken
Expand All @@ -31,8 +41,6 @@ func (api *API) assignableSiteRoles(rw http.ResponseWriter, r *http.Request) {
// @Param organization path string true "Organization ID" format(uuid)
// @Success 200 {array} codersdk.AssignableRoles
// @Router /organizations/{organization}/members/roles [get]
//
// assignableSiteRoles returns all site wide roles that can be assigned.
func (api *API) assignableOrgRoles(rw http.ResponseWriter, r *http.Request) {
ctx := r.Context()
organization := httpmw.OrganizationParam(r)
Expand Down
8 changes: 8 additions & 0 deletions coderd/users.go
Original file line number Diff line number Diff line change
Expand Up @@ -970,6 +970,14 @@ func (api *API) postLogin(rw http.ResponseWriter, r *http.Request) {
}

// Clear the user's session cookie.
//
// @Summary Log out user
// @ID log-out-user
// @Security CoderSessionToken
// @Produce json
// @Tags Users
// @Success 200 {object} codersdk.Response
// @Router /users/logout [post]
func (api *API) postLogout(rw http.ResponseWriter, r *http.Request) {
ctx := r.Context()
// Get a blank token cookie.
Expand Down
46 changes: 46 additions & 0 deletions docs/api/members.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,49 @@ curl -X PUT http://coder-server:8080/api/v2/organizations/{organization}/members
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | [codersdk.OrganizationMember](schemas.md#codersdkorganizationmember) |

To perform this operation, you must be authenticated. [Learn more](authentication.md).

## Get site member roles

### Code samples

```shell
# Example request using curl
curl -X GET http://coder-server:8080/api/v2/users/roles \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY'
```

`GET /users/roles`

### Example responses

> 200 Response

```json
[
{
"assignable": true,
"display_name": "string",
"name": "string"
}
]
```

### Responses

| Status | Meaning | Description | Schema |
| ------ | ------------------------------------------------------- | ----------- | ----------------------------------------------------------------------- |
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | array of [codersdk.AssignableRoles](schemas.md#codersdkassignableroles) |

<h3 id="get-site-member-roles-responseschema">Response Schema</h3>

Status Code **200**

| Name | Type | Required | Restrictions | Description |
| ---------------- | ------- | -------- | ------------ | ----------- |
| `[array item]` | array | false | | |
| `» assignable` | boolean | false | | |
| `» display_name` | string | false | | |
| `» name` | string | false | | |

To perform this operation, you must be authenticated. [Learn more](authentication.md).
38 changes: 38 additions & 0 deletions docs/api/users.md
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,44 @@ curl -X POST http://coder-server:8080/api/v2/users/first \

To perform this operation, you must be authenticated. [Learn more](authentication.md).

## Log out user

### Code samples

```shell
# Example request using curl
curl -X POST http://coder-server:8080/api/v2/users/logout \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY'
```

`POST /users/logout`

### Example responses

> 200 Response

```json
{
"detail": "string",
"message": "string",
"validations": [
{
"detail": "string",
"field": "string"
}
]
}
```

### Responses

| Status | Meaning | Description | Schema |
| ------ | ------------------------------------------------------- | ----------- | ------------------------------------------------ |
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | [codersdk.Response](schemas.md#codersdkresponse) |

To perform this operation, you must be authenticated. [Learn more](authentication.md).

## OAuth 2.0 GitHub Callback

### Code samples
Expand Down