fix support OBDAdminAction is valid action (#9354)

This commit is contained in:
Harshavardhana 2020-04-15 12:16:40 -07:00 committed by GitHub
parent 6a8298b137
commit bde0f444db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 4 deletions

View File

@ -565,7 +565,16 @@ func (a adminAPIHandlers) ListCannedPolicies(w http.ResponseWriter, r *http.Requ
return
}
if err = json.NewEncoder(w).Encode(policies); err != nil {
var newPolicies = make(map[string]iampolicy.Policy)
for name, p := range policies {
_, err = json.Marshal(p)
if err != nil {
logger.LogIf(ctx, err)
continue
}
newPolicies[name] = p
}
if err = json.NewEncoder(w).Encode(newPolicies); err != nil {
writeErrorResponseJSON(ctx, w, toAdminAPIErr(ctx, err), r.URL)
return
}

View File

@ -115,6 +115,7 @@ var supportedAdminActions = map[AdminAction]struct{}{
TopLocksAdminAction: {},
ProfilingAdminAction: {},
TraceAdminAction: {},
OBDInfoAdminAction: {},
ConsoleLogAdminAction: {},
KMSKeyStatusAdminAction: {},
ServerUpdateAdminAction: {},
@ -159,6 +160,7 @@ var adminActionConditionKeyMap = map[Action]condition.KeySet{
StorageInfoAdminAction: condition.NewKeySet(condition.AllSupportedAdminKeys...),
ServerInfoAdminAction: condition.NewKeySet(condition.AllSupportedAdminKeys...),
DataUsageInfoAdminAction: condition.NewKeySet(condition.AllSupportedAdminKeys...),
OBDInfoAdminAction: condition.NewKeySet(condition.AllSupportedAdminKeys...),
TopLocksAdminAction: condition.NewKeySet(condition.AllSupportedAdminKeys...),
ProfilingAdminAction: condition.NewKeySet(condition.AllSupportedAdminKeys...),
TraceAdminAction: condition.NewKeySet(condition.AllSupportedAdminKeys...),

View File

@ -72,9 +72,10 @@ var AdminDiagnostics = Policy{
{
SID: policy.ID(""),
Effect: policy.Allow,
Actions: NewActionSet(ProfilingAdminAction, TraceAdminAction,
ConsoleLogAdminAction, ServerInfoAdminAction,
TopLocksAdminAction, OBDInfoAdminAction),
Actions: NewActionSet(ProfilingAdminAction,
TraceAdminAction, ConsoleLogAdminAction,
ServerInfoAdminAction, TopLocksAdminAction,
OBDInfoAdminAction),
Resources: NewResourceSet(NewResource("*", "")),
},
},