-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MODEXPW-488 - permissions-self-check
- Loading branch information
Showing
4 changed files
with
216 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
src/main/java/org/folio/dew/controller/PermissionsSelfCheckController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package org.folio.dew.controller; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.log4j.Log4j2; | ||
import org.folio.spring.FolioExecutionContext; | ||
import org.folio.spring.integration.XOkapiHeaders; | ||
import org.openapitools.api.PermissionsSelfCheckApi; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
@RestController | ||
@RequestMapping | ||
@Log4j2 | ||
@RequiredArgsConstructor | ||
public class PermissionsSelfCheckController implements PermissionsSelfCheckApi { | ||
|
||
private final FolioExecutionContext folioExecutionContext; | ||
|
||
@Override | ||
public ResponseEntity<List<String>> getDesiredPermissions() { | ||
var okapiHeaders = folioExecutionContext.getOkapiHeaders(); | ||
var permissions = new ArrayList<>(okapiHeaders.get(XOkapiHeaders.PERMISSIONS)); | ||
return new ResponseEntity<>(permissions, HttpStatus.OK); | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
src/main/resources/swagger.api/permissions-self-check.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
openapi: 3.0.0 | ||
info: | ||
title: Refresh presigned url API | ||
version: v1 | ||
paths: | ||
/permissions-self-check: | ||
get: | ||
description: Get bulk edit desired permissions | ||
operationId: getDesiredPermissions | ||
responses: | ||
'200': | ||
description: List of actual desired permissions for current tenant | ||
content: | ||
application/json: | ||
schema: | ||
type: array | ||
items: | ||
$ref: "#/components/schemas/desiredPermission" | ||
'404': | ||
description: No found | ||
content: | ||
text/plain: | ||
schema: | ||
type: string | ||
example: Desired permissions not found | ||
'500': | ||
description: Internal server errors, e.g. due to misconfiguration | ||
content: | ||
text/plain: | ||
schema: | ||
type: string | ||
example: Internal server error | ||
components: | ||
schemas: | ||
desiredPermission: | ||
type: string |