Access control: allow granting a fixed role dynamically based on the startup settings (#43867)

* allow granting a fixed role dynamically depending on startup config

* move role definition for team writing

* undo test changes

* nicer naming
This commit is contained in:
Ieva
2022-01-11 10:58:40 +00:00
committed by GitHub
parent f60a2e8152
commit a06564fb0d
4 changed files with 25 additions and 19 deletions

View File

@@ -201,7 +201,7 @@ func TestTeamAPIEndpoint_CreateTeam_FGAC(t *testing.T) {
setInitCtxSignedInViewer(sc.initCtx)
input := strings.NewReader(fmt.Sprintf(createTeamCmd, 1))
t.Run("Access control allows creating teams with the correct permissions", func(t *testing.T) {
setAccessControlPermissions(sc.acmock, []*accesscontrol.Permission{{Action: accesscontrol.ActionTeamsCreate}}, 1)
setAccessControlPermissions(sc.acmock, []*accesscontrol.Permission{{Action: ActionTeamsCreate}}, 1)
response := callAPI(sc.server, http.MethodPost, createTeamURL, input, t)
assert.Equal(t, http.StatusOK, response.Code)
})