authorize: remove admin (#1833)

* authorize: remove admin

* regen rego

* add note to upgrading
This commit is contained in:
Caleb Doxsey 2021-02-01 15:22:02 -07:00 committed by GitHub
parent a5a3ab55fc
commit b7f0242090
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 204 additions and 381 deletions

View file

@ -3,9 +3,6 @@ package authenticate
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/pomerium/pomerium/config"
)
@ -131,29 +128,3 @@ func TestNew(t *testing.T) {
})
}
}
func TestIsAdmin(t *testing.T) {
tests := []struct {
name string
user string
admins []string
isAdmin bool
}{
{"Is admin", "foo@bar.com", []string{"foo@bar.com"}, true},
{"Is not admin", "foo@bar.com", []string{"baz@bar.com"}, false},
{"Empty admin groups", "foo@bar.com", []string{}, false},
{"Empty user", "", []string{"foo@bar.com"}, false},
}
for _, tc := range tests {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
opts := newTestOptions(t)
opts.Administrators = tc.admins
a, err := New(&config.Config{Options: opts})
a.OnConfigChange(&config.Config{Options: opts})
require.NoError(t, err)
assert.True(t, a.isAdmin(tc.user) == tc.isAdmin)
})
}
}