MCPcopy Index your code
hub / github.com/coder/coder / AuthCheck

Method AuthCheck

codersdk/authorization.go:64–75  ·  view source on GitHub ↗

AuthCheck allows the authenticated user to check if they have the given permissions to a set of resources.

(ctx context.Context, req AuthorizationRequest)

Source from the content-addressed store, hash-verified

62// AuthCheck allows the authenticated user to check if they have the given permissions
63// to a set of resources.
64func (c *Client) AuthCheck(ctx context.Context, req AuthorizationRequest) (AuthorizationResponse, error) {
65 res, err := c.Request(ctx, http.MethodPost, "/api/v2/authcheck", req)
66 if err != nil {
67 return nil, err
68 }
69 defer res.Body.Close()
70 if res.StatusCode != http.StatusOK {
71 return AuthorizationResponse{}, ReadBodyAsError(res)
72 }
73 var resp AuthorizationResponse
74 return resp, json.NewDecoder(res.Body).Decode(&resp)
75}

Callers 4

TestCheckPermissionsFunction · 0.80
RunFunction · 0.80
TestCheckACLPermissionsFunction · 0.80
CanGenerateFullFunction · 0.80

Calls 3

RequestMethod · 0.95
ReadBodyAsErrorFunction · 0.85
CloseMethod · 0.65

Tested by 2

TestCheckPermissionsFunction · 0.64
TestCheckACLPermissionsFunction · 0.64