Skip to content

Commit 9950d35

Browse files
committed
WIP
1 parent a26eac5 commit 9950d35

File tree

4 files changed

+17
-17
lines changed

4 files changed

+17
-17
lines changed

coderd/apidoc/docs.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -716,7 +716,6 @@ const docTemplate = `{
716716
"type": "object",
717717
"properties": {
718718
"action": {
719-
"description": "Action can be ` + "`" + `create` + "`" + `, ` + "`" + `read` + "`" + `, ` + "`" + `update` + "`" + `, or ` + "`" + `delete` + "`" + `",
720719
"type": "string",
721720
"enum": [
722721
"create",
@@ -726,7 +725,7 @@ const docTemplate = `{
726725
]
727726
},
728727
"object": {
729-
"description": "Object can represent a \"set\" of objects, such as: all workspaces in an organization, all workspaces owned by me, all workspaces across the entire product.",
728+
"description": "Object can represent a \"set\" of objects, such as:\n\t- All workspaces in an organization\n\t- All workspaces owned by me\n\t- All workspaces across the entire product\nWhen defining an object, use the most specific language when possible to\nproduce the smallest set. Meaning to set as many fields on 'Object' as\nyou can. Example, if you want to check if you can update all workspaces\nowned by 'me', try to also add an 'OrganizationID' to the settings.\nOmitting the 'OrganizationID' could produce the incorrect value, as\nworkspaces have both ` + "`" + `user` + "`" + ` and ` + "`" + `organization` + "`" + ` owners.",
730729
"$ref": "#/definitions/codersdk.AuthorizationObject"
731730
}
732731
}

coderd/apidoc/swagger.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -637,12 +637,11 @@
637637
"type": "object",
638638
"properties": {
639639
"action": {
640-
"description": "Action can be `create`, `read`, `update`, or `delete`",
641640
"type": "string",
642641
"enum": ["create", "read", "update", "delete"]
643642
},
644643
"object": {
645-
"description": "Object can represent a \"set\" of objects, such as: all workspaces in an organization, all workspaces owned by me, all workspaces across the entire product.",
644+
"description": "Object can represent a \"set\" of objects, such as:\n\t- All workspaces in an organization\n\t- All workspaces owned by me\n\t- All workspaces across the entire product\nWhen defining an object, use the most specific language when possible to\nproduce the smallest set. Meaning to set as many fields on 'Object' as\nyou can. Example, if you want to check if you can update all workspaces\nowned by 'me', try to also add an 'OrganizationID' to the settings.\nOmitting the 'OrganizationID' could produce the incorrect value, as\nworkspaces have both `user` and `organization` owners.",
646645
"$ref": "#/definitions/codersdk.AuthorizationObject"
647646
}
648647
}

codersdk/authorization.go

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,20 @@ type AuthorizationRequest struct {
2323
// AuthorizationCheck is used to check if the currently authenticated user (or
2424
// the specified user) can do a given action to a given set of objects.
2525
type AuthorizationCheck struct {
26-
// Object can represent a "set" of objects, such as: all workspaces in an organization, all workspaces owned by me, all workspaces across the entire product.
26+
// Object can represent a "set" of objects, such as:
27+
// - All workspaces in an organization
28+
// - All workspaces owned by me
29+
// - All workspaces across the entire product
30+
// When defining an object, use the most specific language when possible to
31+
// produce the smallest set. Meaning to set as many fields on 'Object' as
32+
// you can. Example, if you want to check if you can update all workspaces
33+
// owned by 'me', try to also add an 'OrganizationID' to the settings.
34+
// Omitting the 'OrganizationID' could produce the incorrect value, as
35+
// workspaces have both `user` and `organization` owners.
2736
Object AuthorizationObject `json:"object"`
28-
// Action can be `create`, `read`, `update`, or `delete`
29-
Action string `json:"action" enums:"create,read,update,delete"`
37+
Action string `json:"action" enums:"create,read,update,delete"`
3038
}
3139

32-
// AuthorizationObject: when defining, use the most specific language when possible to
33-
// produce the smallest set. Meaning to set as many fields on `Object` as
34-
// you can. Example, if you want to check if you can update all workspaces
35-
// owned by `me`, try to also add an `OrganizationID` to the settings.
36-
// Omitting the `OrganizationID` could produce the incorrect value, as
37-
// workspaces have both `user` and `organization` owners.
3840
type AuthorizationObject struct {
3941
// ResourceType is the name of the resource.
4042
// `./coderd/rbac/object.go` has the list of valid resource types.

docs/api/schemas.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@
1818

1919
### Properties
2020

21-
| Name | Type | Required | Restrictions | Description |
22-
| -------- | ------------------------------------------------------------ | -------- | ------------ | ----------------------------------------------------- |
23-
| `action` | string | false | none | Action can be `create`, `read`, `update`, or `delete` |
24-
| `object` | [codersdk.AuthorizationObject](#codersdkauthorizationobject) | false | none | none |
21+
| Name | Type | Required | Restrictions | Description |
22+
| -------- | ------------------------------------------------------------ | -------- | ------------ | ----------- |
23+
| `action` | string | false | none | none |
24+
| `object` | [codersdk.AuthorizationObject](#codersdkauthorizationobject) | false | none | none |
2525

2626
#### Enumerated Values
2727

0 commit comments

Comments
 (0)