Commit ebce26bb authored by descamps's avatar descamps
Browse files

24/11/2021 - KDE - Gestion Des rôles

parent b0da561f
......@@ -78,14 +78,14 @@ public class ArchivalProfileUnitExternalController {
private ArchivalProfileUnitExternalService archivalProfileUnitExternalService;
@GetMapping()
//@Secured(ServicesData.ROLE_GET_PASTIS)
//@Secured(ServicesData.ROLE_GET_ARCHIVE_PROFILES_UNIT)
public Collection<ArchivalProfileUnitDto> getAll(final Optional<String> criteria) {
LOGGER.debug("get all archival unit profiles criteria={}", criteria);
RestUtils.checkCriteria(criteria);
return archivalProfileUnitExternalService.getAll(criteria);
}
// @Secured(ServicesData.ROLE_GET_PASTIS)
// @Secured(ServicesData.ROLE_GET_ARCHIVE_PROFILES_UNIT)
@GetMapping(params = { "page", "size" })
public PaginatedValuesDto<ArchivalProfileUnitDto> getAllPaginated(@RequestParam final Integer page, @RequestParam final Integer size,
@RequestParam(required = false) final Optional<String> criteria, @RequestParam(required = false) final Optional<String> orderBy,
......@@ -94,7 +94,7 @@ public class ArchivalProfileUnitExternalController {
return archivalProfileUnitExternalService.getAllPaginated(page, size, criteria, orderBy, direction);
}
// @Secured(ServicesData.ROLE_GET_PASTIS)
// @Secured(ServicesData.ROLE_GET_ARCHIVE_PROFILES_UNIT)
@GetMapping(path = RestApi.PATH_REFERENTIAL_ID)
public ArchivalProfileUnitDto getOne(final @PathVariable("identifier") String identifier) {
LOGGER.debug("get archival unit profile identifier={}");
......@@ -102,9 +102,8 @@ public class ArchivalProfileUnitExternalController {
return archivalProfileUnitExternalService.getOne(identifier);
}
// @Secured(ServicesData.ROLE_UPDATE_ARCHIVE_PROFILES_UNIT)
@PutMapping(CommonConstants.PATH_ID)
// @Secured(ServicesData.ROLE_UPDATE_PASTIS)
public ArchivalProfileUnitDto update(final @PathVariable("id") String id, final @Valid @RequestBody ArchivalProfileUnitDto dto) {
LOGGER.debug("Update archival unit profile with identifier metadata {} to {}", id, dto);
SanityChecker.check(id);
......@@ -117,7 +116,7 @@ public class ArchivalProfileUnitExternalController {
* @param archivalProfileUnitDto Entity to create
* @return entity created
*/
//@Secured(ServicesData.ROLE_CREATE_PASTIS)
//@Secured(ServicesData.ROLE_CREATE_ARCHIVE_PROFILES_UNIT)
@ResponseStatus(HttpStatus.CREATED)
@PostMapping
public ArchivalProfileUnitDto create(final @Valid @RequestBody ArchivalProfileUnitDto archivalProfileUnitDto) {
......@@ -132,7 +131,7 @@ public class ArchivalProfileUnitExternalController {
* @param file the agency csv file to import
* @return the vitam response
*/
//@Secured(ServicesData.ROLE_IMPORT_ARCHIVE_PROFILES)
//@Secured(ServicesData.ROLE_IMPORT_ARCHIVE_PROFILES_UNIT)
@PostMapping(CommonConstants.PATH_IMPORT)
public JsonNode importArchivalUnitProfiles(@RequestParam("fileName") String fileName, @RequestParam("file") MultipartFile file) {
LOGGER.debug("Import Archival Unit Profile file {}", fileName);
......
......@@ -118,6 +118,7 @@ public class ProfileExternalController {
* @param file MultipartFile representing the data to import
* @return The jaxRs Response
*/
//@Secured(ServicesData.ROLE_UPDATE_ARCHIVE_PROFILES)
@PutMapping(value = "/updateProfileFile" + CommonConstants.PATH_ID)
public ResponseEntity<JsonNode> importProfileFile(final @PathVariable("id") String id,
@RequestParam("file") MultipartFile file) throws IOException {
......@@ -138,7 +139,6 @@ public class ProfileExternalController {
*/
//@Secured(ServicesData.ROLE_UPDATE_ARCHIVE_PROFILES)
@PutMapping(CommonConstants.PATH_ID)
//@Secured(ServicesData.ROLE_UPDATE_USERS)
public ProfileDto update(final @PathVariable("id") String id, final @Valid @RequestBody ProfileDto dto) {
LOGGER.debug("Update {} with {}", id, dto);
SanityChecker.check(id);
......
......@@ -361,7 +361,28 @@ public class ServicesData {
//------------------------------ PROFILES (ARCHIVE PROFILES) --------------------------------------
public static final String ROLE_GET_ARCHIVE_PROFILES = ROLE_PREFIX + "GET_ARCHIVE_PROFILES";
public static final String SERVICE_ARCHIVE_PROFILES = "ARCHIVE_PROFILES";
public static final String ROLE_GET_ARCHIVE_PROFILES = GET_ROLE_PREFIX + SERVICE_ARCHIVE_PROFILES;
public static final String ROLE_UPDATE_ARCHIVE_PROFILES = CREATE_ROLE_PREFIX + SERVICE_ARCHIVE_PROFILES;
public static final String ROLE_CREATE_ARCHIVE_PROFILES = UPDATE_ROLE_PREFIX + SERVICE_ARCHIVE_PROFILES;
public static final String ROLE_IMPORT_ARCHIVE_PROFILES = DELETE_ROLE_PREFIX + SERVICE_ARCHIVE_PROFILES;
//------------------------------------ ARCHIVE PROFILES UNIT -----------------------------------
public static final String SERVICE_ARCHIVE_PROFILES_UNIT = "ARCHIVE_PROFILES_UNIT";
public static final String ROLE_GET_ARCHIVE_PROFILES_UNIT = GET_ROLE_PREFIX + SERVICE_ARCHIVE_PROFILES_UNIT;
public static final String ROLE_UPDATE_ARCHIVE_PROFILES_UNIT = CREATE_ROLE_PREFIX + SERVICE_ARCHIVE_PROFILES_UNIT;
public static final String ROLE_CREATE_ARCHIVE_PROFILES_UNIT = UPDATE_ROLE_PREFIX + SERVICE_ARCHIVE_PROFILES_UNIT;
public static final String ROLE_IMPORT_ARCHIVE_PROFILES_UNIT = DELETE_ROLE_PREFIX + SERVICE_ARCHIVE_PROFILES_UNIT;
//------------------------------------ INGESTS -----------------------------------------
......
......@@ -11,7 +11,9 @@ db.contexts.insert({
"ROLE_GET_USERS", "ROLE_CREATE_USERS", "ROLE_UPDATE_USERS", "ROLE_UPDATE_STANDARD_USERS", "ROLE_GENERIC_USERS", "ROLE_MFA_USERS", "ROLE_ANONYMIZATION_USERS",
"ROLE_UPDATE_ME_USERS",
"ROLE_GET_PROFILES", "ROLE_CREATE_PROFILES", "ROLE_UPDATE_PROFILES", "ROLE_DELETE_PROFILES",
"ROLE_GET_TENANTS", "ROLE_CREATE_TENANTS", "ROLE_CREATE_TENANTS_ALL_CUSTOMERS", "ROLE_UPDATE_TENANTS", "ROLE_UPDATE_TENANTS_ALL_CUSTOMERS", "ROLE_GET_ALL_TENANTS"
"ROLE_GET_TENANTS", "ROLE_CREATE_TENANTS", "ROLE_CREATE_TENANTS_ALL_CUSTOMERS", "ROLE_UPDATE_TENANTS", "ROLE_UPDATE_TENANTS_ALL_CUSTOMERS", "ROLE_GET_ALL_TENANTS",
"ROLE_GET_ARCHIVE_PROFILES", "ROLE_UPDATE_ARCHIVE_PROFILES", "ROLE_CREATE_ARCHIVE_PROFILES", "ROLE_IMPORT_ARCHIVE_PROFILES",
"ROLE_GET_ARCHIVE_PROFILES_UNIT", "ROLE_UPDATE_ARCHIVE_PROFILES_UNIT", "ROLE_CREATE_ARCHIVE_PROFILES_UNIT", "ROLE_IMPORT_ARCHIVE_PROFILES_UNIT"
]
});
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment