mirror of
https://github.com/minio/minio.git
synced 2025-11-06 20:33:07 -05:00
Add option to policy info API to return create/mod timestamps (#13796)
- This introduces a new admin API with a query parameter (v=2) to return a response with the timestamps - Older API still works for compatibility/smooth transition in console
This commit is contained in:
committed by
GitHub
parent
878d368cea
commit
44fefe5b9f
23
cmd/iam.go
23
cmd/iam.go
@@ -477,13 +477,28 @@ func (sys *IAMSys) DeletePolicy(ctx context.Context, policyName string, notifyPe
|
||||
return nil
|
||||
}
|
||||
|
||||
// InfoPolicy - expands the canned policy into its JSON structure.
|
||||
func (sys *IAMSys) InfoPolicy(policyName string) (iampolicy.Policy, error) {
|
||||
// InfoPolicy - returns the policy definition with some metadata.
|
||||
func (sys *IAMSys) InfoPolicy(policyName string) (*madmin.PolicyInfo, error) {
|
||||
if !sys.Initialized() {
|
||||
return iampolicy.Policy{}, errServerNotInitialized
|
||||
return nil, errServerNotInitialized
|
||||
}
|
||||
|
||||
return sys.store.GetPolicy(policyName)
|
||||
d, err := sys.store.GetPolicyDoc(policyName)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
pdata, err := json.Marshal(d.Policy)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &madmin.PolicyInfo{
|
||||
PolicyName: policyName,
|
||||
Policy: pdata,
|
||||
CreateDate: d.CreateDate,
|
||||
UpdateDate: d.UpdateDate,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// ListPolicies - lists all canned policies.
|
||||
|
||||
Reference in New Issue
Block a user