stable
Clone or download
Part of epic #12142 Baseline v1 Permissions should be checked on service, not on rest api. Indeed, a service may be called indirectly by multiple resources, and we don't want to: - duplicate permissions checks. - make rest implementation dependent on services implementations Example: Let's imagine a baseline service which creates automatically a new comparison when creating a new baselines. So, this service will call an comparison service to create a new comparison. Comparison creation permission should be verified. Do we want the REST resource check baseline creation and comparison creation ? This would implies an implicit dependency from REST resource to baseline creation implementation, which is not a good thing for maintainability. Change-Id: I1cf2c9432da4c1c7fe9bd5abc3a23c40061dbf58
Modified Files
Name | ||||
---|---|---|---|---|
M | composer.json | +2 | −1 | Go to diff View file |
A | include/Adapter/ProjectPermissionsImpl.php | +56 | −0 | Go to diff View file |
A | include/Adapter/SecurityContextImpl.php | +42 | −0 | Go to diff View file |
A | include/Baseline/ArtifactPermissions.php | +78 | −0 | Go to diff View file |
A | include/Baseline/NotAuthorizedException.php | +32 | −0 | Go to diff View file |
A | include/Baseline/ProjectPermissions.php | +32 | −0 | Go to diff View file |
A | include/Baseline/SecurityContext.php | +29 | −0 | Go to diff View file |
D | include/REST/ArtifactPermissionsChecker.php | +0 | −91 | Go to diff View file |
M | include/REST/BaselinesController.php | +15 | −9 | Go to diff View file |
M | include/REST/BaselinesResource.php | +7 | −1 | Go to diff View file |
R | phpunit/REST/ArtifactPermissionsCheckerTest.php | Go to diff View file | ||
M | phpunit/REST/BaselinesControllerTest.php | +13 | −12 | Go to diff View file |