Skip to content

Commit

Permalink
feat(rbac): create, read, update and read user groups
Browse files Browse the repository at this point in the history
  • Loading branch information
omar-chahbouni-decathlon committed Feb 19, 2023
1 parent 2e7a090 commit 1d9cc26
Show file tree
Hide file tree
Showing 81 changed files with 3,486 additions and 1,529 deletions.
1 change: 1 addition & 0 deletions code/api/api/src/main/java/com/decathlon/ara/Entities.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,6 @@ private Entities() {

public static final String SECURITY = "security";
public static final String USER = "user";
public static final String GROUP = "group";

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

package com.decathlon.ara.loader;

import com.decathlon.ara.Entities;
import com.decathlon.ara.domain.Communication;
import com.decathlon.ara.domain.enumeration.CommunicationType;
import com.decathlon.ara.domain.enumeration.Technology;
Expand All @@ -42,6 +41,7 @@
import java.util.Arrays;
import java.util.List;

import static com.decathlon.ara.Entities.PROJECT;
import static com.decathlon.ara.loader.DemoLoaderConstants.*;

/**
Expand Down Expand Up @@ -96,7 +96,7 @@ public DemoSettingsLoader(
}

public ProjectDTO createProjectWithCommunicationsAndRootCauses() throws NotUniqueException, ForbiddenException {
var creationUser = userAccountService.getCurrentUser().orElseThrow(() -> new ForbiddenException(Entities.PROJECT, "demo project creation"));
var creationUser = userAccountService.getCurrentUser().orElseThrow(() -> new ForbiddenException(PROJECT, "demo project creation"));
var demoProject = new ProjectDTO(DEMO_PROJECT_CODE, DEMO_PROJECT_NAME);
return projectService.create(demoProject, creationUser);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,17 @@

import javax.validation.Valid;

import static com.decathlon.ara.web.rest.util.RestConstants.PROJECT_API_PATH;
import static com.decathlon.ara.scenario.cucumber.resource.CucumberResource.CUCUMBER_SCENARIO_BASE_API_PATH;
import static com.decathlon.ara.web.rest.ProjectResource.PROJECT_CODE_BASE_API_PATH;

@RestController
@RequestMapping(CucumberResource.PATH)
@RequestMapping(CUCUMBER_SCENARIO_BASE_API_PATH)
public class CucumberResource {

private static final Logger LOG = LoggerFactory.getLogger(CucumberResource.class);

static final String PATH = PROJECT_API_PATH + "/cucumber";
public static final String PATHS = PATH + "/**";
public static final String CUCUMBER_SCENARIO_BASE_API_PATH = PROJECT_CODE_BASE_API_PATH + "/cucumber";
public static final String CUCUMBER_SCENARIO_ALL_API_PATHS = CUCUMBER_SCENARIO_BASE_API_PATH + "/**";

private final ProjectService projectService;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,17 @@

import java.util.List;

import static com.decathlon.ara.web.rest.util.RestConstants.PROJECT_API_PATH;
import static com.decathlon.ara.scenario.cypress.resource.CypressResource.CYPRESS_SCENARIO_BASE_API_PATH;
import static com.decathlon.ara.web.rest.ProjectResource.PROJECT_CODE_BASE_API_PATH;

@RestController
@RequestMapping(CypressResource.PATH)
@RequestMapping(CYPRESS_SCENARIO_BASE_API_PATH)
public class CypressResource {

private static final Logger LOG = LoggerFactory.getLogger(CypressResource.class);

static final String PATH = PROJECT_API_PATH + "/cypress";
public static final String PATHS = PATH + "/**";
public static final String CYPRESS_SCENARIO_BASE_API_PATH = PROJECT_CODE_BASE_API_PATH + "/cypress";
public static final String CYPRESS_SCENARIO_ALL_API_PATHS = CYPRESS_SCENARIO_BASE_API_PATH + "/**";

private final ProjectService projectService;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,15 @@
import javax.validation.Valid;
import java.util.List;

import static com.decathlon.ara.web.rest.util.RestConstants.PROJECT_API_PATH;
import static com.decathlon.ara.scenario.generic.resource.GenericResource.GENERIC_SCENARIO_BASE_API_PATH;
import static com.decathlon.ara.web.rest.ProjectResource.PROJECT_CODE_BASE_API_PATH;

@RestController
@RequestMapping(GenericResource.PATH)
@RequestMapping(GENERIC_SCENARIO_BASE_API_PATH)
public class GenericResource {

static final String PATH = PROJECT_API_PATH + "/generic";
public static final String PATHS = PATH + "/**";
public static final String GENERIC_SCENARIO_BASE_API_PATH = PROJECT_CODE_BASE_API_PATH + "/generic";
public static final String GENERIC_SCENARIO_ALL_API_PATHS = GENERIC_SCENARIO_BASE_API_PATH + "/**";

private static final Logger LOG = LoggerFactory.getLogger(GenericResource.class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

package com.decathlon.ara.scenario.postman.resource;

import com.decathlon.ara.Entities;
import com.decathlon.ara.scenario.postman.upload.PostmanScenarioUploader;
import com.decathlon.ara.service.ProjectService;
import com.decathlon.ara.service.exception.BadRequestException;
Expand All @@ -34,16 +33,18 @@
import java.io.File;
import java.io.IOException;

import static com.decathlon.ara.web.rest.util.RestConstants.PROJECT_API_PATH;
import static com.decathlon.ara.Entities.SCENARIO;
import static com.decathlon.ara.scenario.postman.resource.PostmanResource.POSTMAN_SCENARIO_BASE_API_PATH;
import static com.decathlon.ara.web.rest.ProjectResource.PROJECT_CODE_BASE_API_PATH;

@RestController
@RequestMapping(PostmanResource.PATH)
@RequestMapping(POSTMAN_SCENARIO_BASE_API_PATH)
public class PostmanResource {

private static final Logger LOG = LoggerFactory.getLogger(PostmanResource.class);

static final String PATH = PROJECT_API_PATH + "/postman";
public static final String PATHS = PATH + "/**";
public static final String POSTMAN_SCENARIO_BASE_API_PATH = PROJECT_CODE_BASE_API_PATH + "/postman";
public static final String POSTMAN_SCENARIO_ALL_API_PATHS = POSTMAN_SCENARIO_BASE_API_PATH + "/**";

private final ProjectService projectService;

Expand Down Expand Up @@ -73,7 +74,7 @@ public ResponseEntity<Void> uploadScenarios(@PathVariable String projectCode,
} catch (IOException e) {
LOG.error("SCENARIO|postman|Project: {} -> Failed to upload ZIP file containing Postman requests for source code {}", projectCode, sourceCode, e);
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
.headers(HeaderUtil.exception(Entities.SCENARIO, e))
.headers(HeaderUtil.exception(SCENARIO, e))
.build();
} finally {
FileUtils.deleteQuietly(tempZipFile);
Expand Down
Loading

0 comments on commit 1d9cc26

Please sign in to comment.