fixed upload right managment. Checking if the hs code is 10 - 12 chars long and numbers only

This commit is contained in:
Jan 2025-11-10 22:19:10 +01:00
parent 3e9e9e1d34
commit dc6ed83853
2 changed files with 5 additions and 4 deletions

View file

@ -72,12 +72,14 @@ public class BulkOperationService {
private void checkAuthorized(BulkFileType fileType) {
if( switch (fileType) {
var auth = switch (fileType) {
case CONTAINER_RATE, COUNTRY_MATRIX -> authorizationService.hasAnyRole("SUPER", "FREIGHT");
case MATERIAL -> authorizationService.hasAnyRole("SUPER", "MATERIAL");
case PACKAGING -> authorizationService.hasAnyRole("SUPER", "PACKAGING");
case NODE -> authorizationService.hasAnyRole("SUPER");
}) {
};
if(!auth) {
throw new ForbiddenException("You are not authorized to perform this operation");
}

View file

@ -248,7 +248,6 @@ public class MaterialFastExcelMapper {
* Validates HS Code (placeholder for API validation)
*/
private boolean validateHsCode(String hsCode) {
//TODO check via api?!
return true;
return hsCode.length() >= 10 && hsCode.length() <= 12 && hsCode.matches("[0-9]+");
}
}