mirror of
https://github.com/coder/coder.git
synced 2025-07-18 14:17:22 +00:00
feat: Rbac more coderd endpoints, unit test to confirm (#1437)
* feat: Enforce authorize call on all endpoints - Make 'request()' exported for running custom requests * Rbac users endpoints * 401 -> 403
This commit is contained in:
@ -112,7 +112,7 @@ func TestListRoles(t *testing.T) {
|
||||
})
|
||||
require.NoError(t, err, "create org")
|
||||
|
||||
const unauth = "unauthorized"
|
||||
const unauth = "forbidden"
|
||||
const notMember = "not a member of the organization"
|
||||
|
||||
testCases := []struct {
|
||||
@ -191,7 +191,7 @@ func TestListRoles(t *testing.T) {
|
||||
if c.AuthorizedError != "" {
|
||||
var apiErr *codersdk.Error
|
||||
require.ErrorAs(t, err, &apiErr)
|
||||
require.Equal(t, http.StatusUnauthorized, apiErr.StatusCode())
|
||||
require.Equal(t, http.StatusForbidden, apiErr.StatusCode())
|
||||
require.Contains(t, apiErr.Message, c.AuthorizedError)
|
||||
} else {
|
||||
require.NoError(t, err)
|
||||
|
Reference in New Issue
Block a user