Skip to content
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

Open
wants to merge 21 commits into
base: main
Choose a base branch
from

Conversation

HugoBouttes
Copy link
Contributor

Fabrice B and others added 9 commits August 8, 2024 16:11
…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;
Copy link
Member

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)")
Copy link
Member

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)")
Copy link
Member

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)")
Copy link
Member

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) {
Copy link
Member

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.

Copy link

sonarcloud bot commented Aug 19, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarCloud

@EmmanuelDemey
Copy link
Collaborator

@HugoBouttes what is the status of this PR ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

 Implémenter le nouveau mécanisme pour le module DataSet coté Back (ajouter des tests si non présent)
3 participants