Skip to content

Commit

Permalink
[CLOUDTRUST-3370] Allow consent configuration in social AND corporate
Browse files Browse the repository at this point in the history
  • Loading branch information
fperot74 committed Jul 22, 2021
1 parent ccf22f2 commit 483d36e
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 19 deletions.
17 changes: 9 additions & 8 deletions configuration/dto.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,15 @@ type RealmConfiguration struct {

// RealmAdminConfiguration struct
type RealmAdminConfiguration struct {
Mode *string `json:"mode"`
AvailableChecks map[string]bool `json:"available-checks,omitempty"`
Accreditations []RealmAdminAccreditation `json:"accreditations,omitempty"`
SelfRegisterEnabled *bool `json:"self_register_enabled"`
Theme *string `json:"theme,omitempty"`
NeedVerifiedContact *bool `json:"need_verified_contact,omitempty"`
ConsentRequired *bool `json:"consent_required,omitempty"`
ShowGlnEditing *bool `json:"show_gln_editing,omitempty"`
Mode *string `json:"mode"`
AvailableChecks map[string]bool `json:"available-checks,omitempty"`
Accreditations []RealmAdminAccreditation `json:"accreditations,omitempty"`
SelfRegisterEnabled *bool `json:"self_register_enabled"`
Theme *string `json:"theme,omitempty"`
NeedVerifiedContact *bool `json:"need_verified_contact,omitempty"`
ConsentRequiredSocial *bool `json:"consent_required,omitempty"`
ConsentRequiredCorporate *bool `json:"consent_required_corp,omitempty"`
ShowGlnEditing *bool `json:"show_gln_editing,omitempty"`
}

// RealmAdminAccreditation struct
Expand Down
9 changes: 4 additions & 5 deletions http/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ type GenericResponse struct {
// WriteResponse writes a response for a mime content type
func (r *GenericResponse) WriteResponse(w http.ResponseWriter) {
if r.Headers == nil {
r.Headers = make(map[string]string, 0)
r.Headers = make(map[string]string)
}
// Headers
if r.MimeContent != nil {
Expand Down Expand Up @@ -113,11 +113,10 @@ func DecodeRequestWithHeaders(_ context.Context, req *http.Request, pathParams m
}
}

if headers != nil {
for _, headerKey := range headers {
request[headerKey] = req.Header.Get(headerKey)
}
for _, headerKey := range headers {
request[headerKey] = req.Header.Get(headerKey)
}

return request, nil
}

Expand Down
3 changes: 1 addition & 2 deletions http/handlers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@ func TestHTTPManagementHandler(t *testing.T) {
var mockCtrl = gomock.NewController(t)
defer mockCtrl.Finish()

var e endpoint.Endpoint
e = func(ctx context.Context, req interface{}) (interface{}, error) {
var e = func(ctx context.Context, req interface{}) (interface{}, error) {
var m = req.(map[string]string)
res := fmt.Sprint(len(m))
if v, err := m["pathParameter1"]; err {
Expand Down
8 changes: 4 additions & 4 deletions http/rights_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ func TestMakeRightsHandler(t *testing.T) {
mockAuthManager := mock.NewAuthorizationManager(mockCtrl)

var rights = map[string]map[string]map[string]map[string]struct{}{
"toe_administrator": map[string]map[string]map[string]struct{}{
"GetUsers": map[string]map[string]struct{}{
"master": map[string]struct{}{
"*": struct{}{},
"toe_administrator": {
"GetUsers": {
"master": {
"*": {},
},
},
},
Expand Down

0 comments on commit 483d36e

Please sign in to comment.