mirror of
https://github.com/pomerium/pomerium.git
synced 2025-05-10 07:37:33 +02:00
authorize: remove admin (#1833)
* authorize: remove admin * regen rego * add note to upgrading
This commit is contained in:
parent
a5a3ab55fc
commit
b7f0242090
17 changed files with 204 additions and 381 deletions
|
@ -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)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue