fix support OBDAdminAction is valid action (#9354)

master
Harshavardhana 5 years ago committed by GitHub
parent 6a8298b137
commit bde0f444db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      cmd/admin-handlers-users.go
  2. 2
      pkg/iam/policy/admin-action.go
  3. 7
      pkg/iam/policy/constants.go

@ -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
}

@ -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...),

@ -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("*", "")),
},
},

Loading…
Cancel
Save