Skip to content

Commit

Permalink
update formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
kcinay055679 committed Nov 29, 2024
1 parent b17f5d3 commit 3153551
Show file tree
Hide file tree
Showing 183 changed files with 3,844 additions and 2,797 deletions.
19 changes: 1 addition & 18 deletions backend/src/main/java/ch/puzzle/okr/ErrorKey.java
Original file line number Diff line number Diff line change
@@ -1,22 +1,5 @@
package ch.puzzle.okr;

public enum ErrorKey {
ATTRIBUTE_NULL,
ATTRIBUTE_CHANGED,
ATTRIBUTE_SET_FORBIDDEN,
ATTRIBUTE_NOT_SET,
ATTRIBUTE_CANNOT_CHANGE,
ATTRIBUTE_MUST_BE_DRAFT,
KEY_RESULT_CONVERSION,
ALREADY_EXISTS_SAME_NAME,
CONVERT_TOKEN,
DATA_HAS_BEEN_UPDATED,
MODEL_NULL,
MODEL_WITH_ID_NOT_FOUND,
NOT_AUTHORIZED_TO_READ,
NOT_AUTHORIZED_TO_WRITE,
NOT_AUTHORIZED_TO_DELETE,
TOKEN_NULL,
TRIED_TO_DELETE_LAST_ADMIN,
TRIED_TO_REMOVE_LAST_OKR_CHAMPION
ATTRIBUTE_NULL, ATTRIBUTE_CHANGED, ATTRIBUTE_SET_FORBIDDEN, ATTRIBUTE_NOT_SET, ATTRIBUTE_CANNOT_CHANGE, ATTRIBUTE_MUST_BE_DRAFT, KEY_RESULT_CONVERSION, ALREADY_EXISTS_SAME_NAME, CONVERT_TOKEN, DATA_HAS_BEEN_UPDATED, MODEL_NULL, MODEL_WITH_ID_NOT_FOUND, NOT_AUTHORIZED_TO_READ, NOT_AUTHORIZED_TO_WRITE, NOT_AUTHORIZED_TO_DELETE, TOKEN_NULL, TRIED_TO_DELETE_LAST_ADMIN, TRIED_TO_REMOVE_LAST_OKR_CHAMPION
}
28 changes: 7 additions & 21 deletions backend/src/main/java/ch/puzzle/okr/SecurityConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ public SecurityFilterChain apiSecurityFilterChain(HttpSecurity http, @Value("${c
http.addFilterAfter(new ForwardFilter(), BasicAuthenticationFilter.class);
logger.debug("*** apiSecurityFilterChain reached");
return http.cors(Customizer.withDefaults())
.authorizeHttpRequests(e -> e.requestMatchers("/api/**").authenticated().anyRequest().permitAll())
.authorizeHttpRequests(e -> e.requestMatchers("/api/**")
.authenticated()
.anyRequest()
.permitAll())
.exceptionHandling(e -> e.authenticationEntryPoint(new HttpStatusEntryPoint(HttpStatus.UNAUTHORIZED)))
.oauth2ResourceServer(oauth2 -> oauth2.jwt(Customizer.withDefaults()))
.build();
Expand Down Expand Up @@ -97,29 +100,12 @@ private HttpSecurity setHeaders(HttpSecurity http) throws Exception {
}

private String okrContentSecurityPolicy() {
return "default-src 'self';" +
"script-src 'self' 'unsafe-inline';" +
"style-src 'self' 'unsafe-inline';" +
"object-src 'none';" +
"base-uri 'self';" +
"connect-src 'self' " +
MessageFormat.format("{0};", connectSrc) +
"font-src 'self';" +
"frame-src 'self';" +
"img-src 'self' data: ;" +
"manifest-src 'self';" +
"media-src 'self';" +
"worker-src 'none';";
return "default-src 'self';" + "script-src 'self' 'unsafe-inline';" + "style-src 'self' 'unsafe-inline';" + "object-src 'none';" + "base-uri 'self';" + "connect-src 'self' " + MessageFormat.format("{0};",
connectSrc) + "font-src 'self';" + "frame-src 'self';" + "img-src 'self' data: ;" + "manifest-src 'self';" + "media-src 'self';" + "worker-src 'none';";
}

private String okrPermissionPolicy() {
return "accelerometer=(), ambient-light-sensor=(), autoplay=(), " +
"battery=(), camera=(), cross-origin-isolated=(), display-capture=(), document-domain=(), encrypted-media=(), " +
"execution-while-not-rendered=(), execution-while-out-of-viewport=(), fullscreen=()," +
" geolocation=(), gyroscope=(), keyboard-map=(), magnetometer=(), microphone=(), " +
"midi=(), navigation-override=(), payment=(), picture-in-picture=()," +
" publickey-credentials-get=(), screen-wake-lock=(), sync-xhr=(self), " +
"usb=(), web-share=(), xr-spatial-tracking=()";
return "accelerometer=(), ambient-light-sensor=(), autoplay=(), " + "battery=(), camera=(), cross-origin-isolated=(), display-capture=(), document-domain=(), encrypted-media=(), " + "execution-while-not-rendered=(), execution-while-out-of-viewport=(), fullscreen=()," + " geolocation=(), gyroscope=(), keyboard-map=(), magnetometer=(), microphone=(), " + "midi=(), navigation-override=(), payment=(), picture-in-picture=()," + " publickey-credentials-get=(), screen-wake-lock=(), sync-xhr=(self), " + "usb=(), web-share=(), xr-spatial-tracking=()";
}

@Bean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,15 @@ public ActionController(ActionAuthorizationService actionAuthorizationService, A
}

@Operation(summary = "Update Actions", description = "Update Actions of KeyResult")
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "Updated Actions of KeyResult",
content = {@Content(mediaType = "application/json", schema = @Schema(
implementation = ActionDto.class))}), @ApiResponse(responseCode = "400",
description = "Can't update Actions, attributes are not set",
content = @Content)})
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "Updated Actions of KeyResult", content = {@Content(mediaType = "application/json", schema = @Schema(implementation = ActionDto.class))}), @ApiResponse(responseCode = "400", description = "Can't update Actions, attributes are not set", content = @Content)})
@PutMapping
public void updateActions(@io.swagger.v3.oas.annotations.parameters.RequestBody(description = "The Action as json to update existing Actions.",
required = true) @RequestBody List<ActionDto> actionDtoList) {
public void updateActions(@io.swagger.v3.oas.annotations.parameters.RequestBody(description = "The Action as json to update existing Actions.", required = true) @RequestBody List<ActionDto> actionDtoList) {
List<Action> actionList = actionMapper.toActions(actionDtoList);
actionAuthorizationService.updateEntities(actionList);
}

@Operation(summary = "Delete Action by Id", description = "Delete Action by Id")
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "Deleted Action by Id"), @ApiResponse(
responseCode = "404",
description = "Did not find the Action with requested id")})
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "Deleted Action by Id"), @ApiResponse(responseCode = "404", description = "Did not find the Action with requested id")})
@DeleteMapping("/{actionId}")
public void deleteActionById(@PathVariable long actionId) {
actionAuthorizationService.deleteActionByActionId(actionId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,10 @@ public AlignmentController(AlignmentSelectionMapper alignmentSelectionMapper, Al
this.alignmentSelectionBusinessService = alignmentSelectionBusinessService;
}

@Operation(summary = "Get all objectives and their key results to select the alignment",
description = "Get a list of objectives with their key results to select the alignment")
@ApiResponses(value = {@ApiResponse(responseCode = "200",
description = "Returned a list of objectives with their key results to select the alignment",
content = {@Content(mediaType = "application/json", schema = @Schema(
implementation = AlignmentObjectiveDto.class))}), @ApiResponse(responseCode = "400",
description = "Can't return list of objectives with their key results to select the alignment",
content = @Content)})
@Operation(summary = "Get all objectives and their key results to select the alignment", description = "Get a list of objectives with their key results to select the alignment")
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "Returned a list of objectives with their key results to select the alignment", content = {@Content(mediaType = "application/json", schema = @Schema(implementation = AlignmentObjectiveDto.class))}), @ApiResponse(responseCode = "400", description = "Can't return list of objectives with their key results to select the alignment", content = @Content)})
@GetMapping("/selections")
public ResponseEntity<List<AlignmentObjectiveDto>> getAlignmentSelections(@RequestParam(required = false,
defaultValue = "",
name = "quarter") Long quarterFilter, @RequestParam(required = false,
defaultValue = "",
name = "team") Long teamFilter) {
public ResponseEntity<List<AlignmentObjectiveDto>> getAlignmentSelections(@RequestParam(required = false, defaultValue = "", name = "quarter") Long quarterFilter, @RequestParam(required = false, defaultValue = "", name = "team") Long teamFilter) {
List<AlignmentSelection> alignmentSelectionByQuarterIdAndTeamIdNot = alignmentSelectionBusinessService.getAlignmentSelectionByQuarterIdAndTeamIdNot(quarterFilter,
teamFilter);
return ResponseEntity.status(HttpStatus.OK)
Expand Down
Loading

0 comments on commit 3153551

Please sign in to comment.