diff --git a/restapi/user_session.go b/restapi/user_session.go index 350cfd94d..b62124a64 100644 --- a/restapi/user_session.go +++ b/restapi/user_session.go @@ -246,7 +246,7 @@ func getSessionResponse(ctx context.Context, session *models.Principal) (*models envConstants.MaxConcurrentDownloads = getMaxConcurrentDownloadsLimit() sessionResp := &models.SessionResponse{ - Features: getListOfEnabledFeatures(session), + Features: getListOfEnabledFeatures(ctx, userAdminClient, session), Status: models.SessionResponseStatusOk, Operator: false, DistributedMode: erasure, @@ -259,7 +259,7 @@ func getSessionResponse(ctx context.Context, session *models.Principal) (*models } // getListOfEnabledFeatures returns a list of features -func getListOfEnabledFeatures(session *models.Principal) []string { +func getListOfEnabledFeatures(ctx context.Context, minioClient MinioAdmin, session *models.Principal) []string { features := []string{} logSearchURL := getLogSearchURL() oidcEnabled := oauth2.IsIDPEnabled() @@ -281,6 +281,12 @@ func getListOfEnabledFeatures(session *models.Principal) []string { if session.Ob { features = append(features, "object-browser-only") } + if minioClient != nil { + _, err := minioClient.kmsStatus(ctx) + if err == nil { + features = append(features, "kms") + } + } return features } diff --git a/restapi/user_session_test.go b/restapi/user_session_test.go index f980d84c9..89fde948e 100644 --- a/restapi/user_session_test.go +++ b/restapi/user_session_test.go @@ -130,7 +130,7 @@ func Test_getListOfEnabledFeatures(t *testing.T) { if tt.preFunc != nil { tt.preFunc() } - assert.Equalf(t, tt.want, getListOfEnabledFeatures(tt.args.session), "getListOfEnabledFeatures(%v)", tt.args.session) + assert.Equalf(t, tt.want, getListOfEnabledFeatures(context.Background(), nil, tt.args.session), "getListOfEnabledFeatures(%v)", tt.args.session) if tt.postFunc != nil { tt.postFunc() }