Skip to content

Commit

Permalink
Add role to profile (#367)
Browse files Browse the repository at this point in the history
  • Loading branch information
kendallstrautman authored Oct 16, 2024
1 parent 7062fdd commit 96db562
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/sso/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,9 @@ type Profile struct {
// The user last name. Can be empty.
LastName string `json:"last_name"`

// The role given to this user profile. Can be empty.
Role common.RoleResponse `json:"role"`

// The user's group memberships. Can be empty.
Groups []string `json:"groups"`

Expand Down
12 changes: 12 additions & 0 deletions pkg/sso/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,9 @@ func TestClientGetProfileAndToken(t *testing.T) {
Email: "foo@test.com",
FirstName: "foo",
LastName: "bar",
Role: common.RoleResponse{
Slug: "admin",
},
Groups: []string{"Admins", "Developers"},
RawAttributes: map[string]interface{}{
"idp_id": "123",
Expand Down Expand Up @@ -217,6 +220,9 @@ func profileAndTokenTestHandler(w http.ResponseWriter, r *http.Request) {
Email: "foo@test.com",
FirstName: "foo",
LastName: "bar",
Role: common.RoleResponse{
Slug: "admin",
},
Groups: []string{"Admins", "Developers"},
RawAttributes: map[string]interface{}{
"idp_id": "123",
Expand Down Expand Up @@ -261,6 +267,9 @@ func TestClientGetProfile(t *testing.T) {
Email: "foo@test.com",
FirstName: "foo",
LastName: "bar",
Role: common.RoleResponse{
Slug: "admin",
},
Groups: []string{"Admins", "Developers"},
RawAttributes: map[string]interface{}{
"idp_id": "123",
Expand Down Expand Up @@ -313,6 +322,9 @@ func profileTestHandler(w http.ResponseWriter, r *http.Request) {
Email: "foo@test.com",
FirstName: "foo",
LastName: "bar",
Role: common.RoleResponse{
Slug: "admin",
},
Groups: []string{"Admins", "Developers"},
RawAttributes: map[string]interface{}{
"idp_id": "123",
Expand Down
6 changes: 6 additions & 0 deletions pkg/sso/sso_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ func TestLogin(t *testing.T) {
Email: "foo@test.com",
FirstName: "foo",
LastName: "bar",
Role: common.RoleResponse{
Slug: "admin",
},
Groups: []string{"Admins", "Developers"},
RawAttributes: map[string]interface{}{
"idp_id": "123",
Expand Down Expand Up @@ -166,6 +169,9 @@ func TestSsoGetProfile(t *testing.T) {
Email: "foo@test.com",
FirstName: "foo",
LastName: "bar",
Role: common.RoleResponse{
Slug: "admin",
},
Groups: []string{"Admins", "Developers"},
RawAttributes: map[string]interface{}{
"idp_id": "123",
Expand Down

0 comments on commit 96db562

Please sign in to comment.