-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
638 nbspimplmenter le nouveau mcanisme pour le module dataset cot back ajouter des tests si non prsent #720
base: main
Are you sure you want to change the base?
Conversation
…le-module-dataset-cot-back-ajouter-des-tests-si-non-prsent
- Limit dependencies to userProvider to security layer - Reduce dependency over deprecated class StampRestrictionServiceImpl
- less coupling - more tests case for access control - parametrized tests
- Un utilisateur avec la stratégie STAMP ne peut créer de ressource que pour son timbre - Un utilisateur avec la stratégie ALL peut créer des ressources pour n'importe quel timbre
…le-module-dataset-cot-back-ajouter-des-tests-si-non-prsent
@@ -19,6 +19,7 @@ | |||
import org.springframework.http.HttpStatus; | |||
import org.springframework.http.ResponseEntity; | |||
import org.springframework.security.access.prepost.PreAuthorize; | |||
import org.springframework.security.core.annotation.AuthenticationPrincipal; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Import inutile
@@ -38,28 +39,31 @@ public DatasetResources(DatasetService datasetService) { | |||
this.datasetService = datasetService; | |||
} | |||
|
|||
// @PreAuthorize("canReadDataset(#datasetId)") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
C'est bien l'annotation attendue. Pourquoi la commenter ?
@GetMapping(produces = "application/json") | ||
@Operation(operationId = "getDatasets", summary = "List of datasets", | ||
responses = {@ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = Dataset.class))))}) | ||
public String getDatasets() throws RmesException { | ||
return this.datasetService.getDatasets(); | ||
} | ||
|
||
// @PreAuthorize("canReadDataset(#datasetId)") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
C'est bien l'annotation attendue. Pourquoi la commenter ?
@GetMapping(value = "/{id}", produces = "application/json") | ||
@Operation(operationId = "getDataset", summary = "Get a dataset", | ||
responses = {@ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = Dataset.class))))}) | ||
public String getDataset(@PathVariable(Constants.ID) String id) throws RmesException { | ||
return this.datasetService.getDatasetByID(id); | ||
} | ||
|
||
// @PreAuthorize("canReadDataset(#datasetId)") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
C'est bien l'annotation attendue. Pourquoi la commenter ?
} | ||
|
||
@Override | ||
public boolean userStampIsAuthorizedForResource(Module module, String id, Stamp stamp) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clarify names of modules (constants of enum Module) to fit with authorization methods of this class.
Quality Gate failedFailed conditions |
@HugoBouttes what is the status of this PR ? |
#638