mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
Added populateOrgName param in /v1/workspace api which adds orgName and displayName in result
Updated the CLI to use this new paramter to display organization name with project name with support for backward compatibility keeping original behaviour for older apis
This commit is contained in:
@@ -170,6 +170,7 @@ func CallGetAllWorkSpacesUserBelongsTo(httpClient *resty.Client) (GetWorkSpacesR
|
||||
R().
|
||||
SetResult(&workSpacesResponse).
|
||||
SetHeader("User-Agent", USER_AGENT).
|
||||
SetQueryParam("populateOrgName", "true").
|
||||
Get(fmt.Sprintf("%v/v1/workspace", config.INFISICAL_URL))
|
||||
|
||||
if err != nil {
|
||||
@@ -180,22 +181,6 @@ func CallGetAllWorkSpacesUserBelongsTo(httpClient *resty.Client) (GetWorkSpacesR
|
||||
return GetWorkSpacesResponse{}, fmt.Errorf("CallGetAllWorkSpacesUserBelongsTo: Unsuccessful response: [response=%v]", response)
|
||||
}
|
||||
|
||||
// Call the organization API
|
||||
orgResponse, err := CallGetAllOrganizations(httpClient)
|
||||
if err != nil {
|
||||
return GetWorkSpacesResponse{}, err
|
||||
}
|
||||
|
||||
// Update organization names in workspacesResponse
|
||||
for i, workspace := range workSpacesResponse.Workspaces {
|
||||
for _, organization := range orgResponse.Organizations {
|
||||
if workspace.Organization == organization.ID {
|
||||
workSpacesResponse.Workspaces[i].Organization = organization.Name
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return workSpacesResponse, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user