Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove API which retrieves authorized sub organizations of user #517

Merged
merged 1 commit into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -249,30 +249,6 @@ public Response organizationsGet( @Valid@ApiParam(value = "Condition to filte
return delegate.organizationsGet(filter, limit, after, before, recursive );
}

@Valid
@GET
@Path("/me")

@Produces({ "application/json" })
@ApiOperation(value = "This API is used to search and retrieve child organizations which are authorized for the user.", notes = "Retrieve authorized sub organizations which matches the defined search criteria, if any.", response = OrganizationsResponse.class, authorizations = {
@Authorization(value = "BasicAuth"),
@Authorization(value = "OAuth2", scopes = {

})
}, tags={ "Organization", })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Successful response", response = OrganizationsResponse.class),
@ApiResponse(code = 400, message = "Invalid input in the request.", response = Error.class),
@ApiResponse(code = 401, message = "Authentication information is missing or invalid.", response = Void.class),
@ApiResponse(code = 403, message = "Access forbidden.", response = Void.class),
@ApiResponse(code = 500, message = "Internal server error.", response = Error.class),
@ApiResponse(code = 501, message = "Not Implemented.", response = Error.class)
})
public Response organizationsGetMe( @Valid@ApiParam(value = "Condition to filter the retrieval of records.") @QueryParam("filter") String filter, @Valid @Min(0)@ApiParam(value = "Maximum number of records to be returned. (Should be greater than 0)") @QueryParam("limit") Integer limit, @Valid@ApiParam(value = "Points to the next range of data to be returned.") @QueryParam("after") String after, @Valid@ApiParam(value = "Points to the previous range of data that can be retrieved.") @QueryParam("before") String before, @Valid@ApiParam(value = "Determines whether a recursive search should happen.", defaultValue="false") @DefaultValue("false") @QueryParam("recursive") Boolean recursive) {

return delegate.organizationsGetMe(filter, limit, after, before, recursive );
}

@Valid
@DELETE
@Path("/{organization-id}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ public interface OrganizationsApiService {

public Response organizationsGet(String filter, Integer limit, String after, String before, Boolean recursive);

public Response organizationsGetMe(String filter, Integer limit, String after, String before, Boolean recursive);

public Response organizationsOrganizationIdDelete(String organizationId);

public Response organizationsOrganizationIdDiscoveryDelete(String organizationId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,4 @@ public Response organizationsDiscoveryGet(String filter, Integer offset, Integer

return organizationManagementService.getOrganizationsDiscoveryAttributes(filter, offset, limit);
}

@Override
public Response organizationsGetMe(String filter, Integer limit, String after, String before, Boolean recursive) {

return organizationManagementService.getAuthorizedOrganizations(filter, limit, after, before, recursive);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -112,36 +112,11 @@ public class OrganizationManagementService {
*/
public Response getOrganizations(String filter, Integer limit, String after, String before, Boolean recursive) {

return getOrganizationList(false, filter, limit, after, before, recursive);
}

/**
* Retrieve organization IDs for authorized user.
*
* @param filter The filter string.
* @param limit The maximum number of records to be returned.
* @param after The pointer to next page.
* @param before The pointer to previous page.
* @param recursive Determines whether recursive search is required.
* @return The list of organization IDs.
*/
public Response getAuthorizedOrganizations(String filter, Integer limit, String after, String before,
Boolean recursive) {

return getOrganizationList(true, filter, limit, after, before, recursive);
}

private Response getOrganizationList(boolean authorizedSubOrgsOnly, String filter, Integer limit, String after,
String before, Boolean recursive) {

try {
limit = validateLimit(limit);
String sortOrder = StringUtils.isNotBlank(before) ? ASC_SORT_ORDER : DESC_SORT_ORDER;
List<BasicOrganization> organizations = authorizedSubOrgsOnly ?
getOrganizationManager().getUserAuthorizedOrganizations(
limit + 1, after, before, sortOrder, filter, Boolean.TRUE.equals(recursive))
: getOrganizationManager().getOrganizations(
limit + 1, after, before, sortOrder, filter, Boolean.TRUE.equals(recursive));
List<BasicOrganization> organizations = getOrganizationManager().getOrganizations(limit + 1, after,
before, sortOrder, filter, Boolean.TRUE.equals(recursive));
return Response.ok().entity(getOrganizationsResponse(limit, after, before, filter, organizations,
Boolean.TRUE.equals(recursive))).build();
} catch (OrganizationManagementClientException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,38 +90,6 @@ paths:
$ref: '#/components/responses/NotImplemented'
tags:
- Organization
/organizations/me:
get:
description:
Retrieve authorized sub organizations which matches the defined search criteria, if any.
summary:
This API is used to search and retrieve child organizations which are authorized for the user.
operationId: organizationsGetMe
parameters:
- $ref: '#/components/parameters/filterQueryParam'
- $ref: '#/components/parameters/limitQueryParam'
- $ref: '#/components/parameters/afterQueryParam'
- $ref: '#/components/parameters/beforeQueryParam'
- $ref: '#/components/parameters/recursiveQueryParam'
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/OrganizationsResponse'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'500':
$ref: '#/components/responses/ServerError'
'501':
$ref: '#/components/responses/NotImplemented'
tags:
- Organization
/organizations/check-name:
post:
summary: Check organization with given name exist among the organizations hierarchy.
Expand Down
Loading