mirror of
https://github.com/minio/minio.git
synced 2025-11-10 22:10:12 -05:00
Add InfoCannedPolicy API to fetch only necessary policy (#8307)
This PR adds - InfoCannedPolicy() API for efficiency in fetching policies - Send group memberships for LDAPUser if available
This commit is contained in:
committed by
kannappanr
parent
3094615e38
commit
fd53057654
@@ -24,6 +24,31 @@ import (
|
||||
"net/url"
|
||||
)
|
||||
|
||||
// InfoCannedPolicy - expand canned policy into JSON structure.
|
||||
func (adm *AdminClient) InfoCannedPolicy(policyName string) ([]byte, error) {
|
||||
queryValues := url.Values{}
|
||||
queryValues.Set("name", policyName)
|
||||
|
||||
reqData := requestData{
|
||||
relPath: "/v1/info-canned-policy",
|
||||
queryValues: queryValues,
|
||||
}
|
||||
|
||||
// Execute GET on /minio/admin/v1/info-canned-policy
|
||||
resp, err := adm.executeMethod("GET", reqData)
|
||||
|
||||
defer closeResponse(resp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
return nil, httpRespToErrorResponse(resp)
|
||||
}
|
||||
|
||||
return ioutil.ReadAll(resp.Body)
|
||||
}
|
||||
|
||||
// ListCannedPolicies - list all configured canned policies.
|
||||
func (adm *AdminClient) ListCannedPolicies() (map[string][]byte, error) {
|
||||
reqData := requestData{
|
||||
|
||||
Reference in New Issue
Block a user