mirror of
https://github.com/pomerium/pomerium.git
synced 2025-07-31 07:19:16 +02:00
directory.Group entry for groups (#1118)
* store directory groups separate from directory users * fix group lookup, azure display name * remove fields restriction * fix test * also support email * use Email as name for google' * remove changed file * show groups on dashboard * fix test * re-add accidentally removed code
This commit is contained in:
parent
489cdd8b63
commit
1ad243dfd1
25 changed files with 525 additions and 209 deletions
|
@ -45,8 +45,8 @@ func newMockAPI(t *testing.T, srv *httptest.Server) http.Handler {
|
|||
r.Get("/groups", func(w http.ResponseWriter, r *http.Request) {
|
||||
_ = json.NewEncoder(w).Encode(M{
|
||||
"value": []M{
|
||||
{"id": "admin", "name": "Admin Group"},
|
||||
{"id": "test", "name": "Test Group"},
|
||||
{"id": "admin", "displayName": "Admin Group"},
|
||||
{"id": "test", "displayName": "Test Group"},
|
||||
},
|
||||
})
|
||||
})
|
||||
|
@ -85,22 +85,26 @@ func Test(t *testing.T) {
|
|||
DirectoryID: "DIRECTORY_ID",
|
||||
}),
|
||||
)
|
||||
users, err := p.UserGroups(context.Background())
|
||||
groups, users, err := p.UserGroups(context.Background())
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, []*directory.User{
|
||||
{
|
||||
Id: "azure/user-1",
|
||||
Groups: []string{"Admin Group", "admin"},
|
||||
Id: "azure/user-1",
|
||||
GroupIds: []string{"admin"},
|
||||
},
|
||||
{
|
||||
Id: "azure/user-2",
|
||||
Groups: []string{"Test Group", "test"},
|
||||
Id: "azure/user-2",
|
||||
GroupIds: []string{"test"},
|
||||
},
|
||||
{
|
||||
Id: "azure/user-3",
|
||||
Groups: []string{"Test Group", "test"},
|
||||
Id: "azure/user-3",
|
||||
GroupIds: []string{"test"},
|
||||
},
|
||||
}, users)
|
||||
assert.Equal(t, []*directory.Group{
|
||||
{Id: "admin", Name: "Admin Group"},
|
||||
{Id: "test", Name: "Test Group"},
|
||||
}, groups)
|
||||
}
|
||||
|
||||
func mustParseURL(rawurl string) *url.URL {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue