stable

Clone or download

Read-only

refactor: build RoleAssignment from Domain

This is part of request #29215 - Clean baseline plugin ⬡ RoleAssignment is a concept belonging to the Baseline Domain. It was built as is by adapters, and we needed to check often that the current role assignment exists and belong to the current baseline project before saving or retrieving them. This refactoring makes RoleAssignment build itself from a ProjectIdentifier and a list of user grouop ids. During the build phase, we make sure that the RoleAssignment is valid (existing ugroup in given project), else we throw an error. In this contribution, I also had to refactor the Role type, because since adapters do not instanciate the RoleAssignment themselves anymore, the @psalm-param Role::* $role directive was no longer convenient. To keep enforcing the usage of an existing role, Role is now an interface implemented by RoleBaselineAdmin and RoleBaselineReader. No functional change expected Change-Id: Ifcb8a9f26aa73626291a1f4482a4abdfd0c98420

Modified Files

Name
M plugins/baseline/include/Adapter/Administration/AdminPermissionsPresenterBuilder.php +4 −3 Go to diff View file
A plugins/baseline/include/Adapter/Administration/BaselineUserGroupRetriever.php +54 −0 Go to diff View file
M plugins/baseline/include/Adapter/Administration/PermissionPerGroupBaselineServicePaneBuilder.php +7 −9 Go to diff View file
M plugins/baseline/include/Adapter/Administration/ProjectHistory.php +10 −14 Go to diff View file
M plugins/baseline/include/Adapter/AuthorizationsImpl.php +5 −3 Go to diff View file
M plugins/baseline/include/Adapter/RoleAssignmentRepositoryAdapter.php +19 −27 Go to diff View file
A plugins/baseline/include/Adapter/UserGroupProxy.php +50 −0 Go to diff View file
A plugins/baseline/include/Domain/BaselineUserGroup.php +28 −0 Go to diff View file
A plugins/baseline/include/Domain/RetrieveBaselineUserGroup.php +29 −0 Go to diff View file
M plugins/baseline/include/Domain/Role.php +2 −3 Go to diff View file
M plugins/baseline/include/Domain/RoleAssignment.php +35 −23 Go to diff View file
M plugins/baseline/include/Domain/RoleAssignmentRepository.php +2 −2 Go to diff View file
A plugins/baseline/include/Domain/RoleAssignmentsUpdate.php +61 −0 Go to diff View file
A plugins/baseline/include/Domain/RoleBaselineAdmin.php +33 −0 Go to diff View file
A plugins/baseline/include/Domain/RoleBaselineReader.php +33 −0 Go to diff View file
A plugins/baseline/include/Domain/UserGroupDoesNotExistOrBelongToCurrentBaselineProjectException.php +33 −0 Go to diff View file
M plugins/baseline/include/ServiceSavePermissionsController.php +43 −39 Go to diff View file
M plugins/baseline/include/Support/ContainerBuilderFactory.php +8 −0 Go to diff View file
M plugins/baseline/include/baselinePlugin.php +3 −4 Go to diff View file
M plugins/baseline/tests/integration/Adapter/RoleAssignmentRepositoryAdapterTest.php +39 −19 Go to diff View file
M plugins/baseline/tests/unit/Adapter/Administration/AdminPermissionsPresenterBuilderTest.php +20 −15 Go to diff View file
M plugins/baseline/tests/unit/Adapter/Administration/PermissionPerGroupBaselineServicePaneBuilderTest.php +10 −13 Go to diff View file
M plugins/baseline/tests/unit/Adapter/Administration/ProjectHistoryTest.php +16 −28 Go to diff View file
M plugins/baseline/tests/unit/ServiceSavePermissionsControllerTest.php +30 −42 Go to diff View file
A plugins/baseline/tests/unit/Stub/RetrieveBaselineUserGroupStub.php +58 −0 Go to diff View file
A plugins/baseline/tests/unit/Support/RoleAssignmentTestBuilder.php +80 −0 Go to diff View file
A plugins/pluginsadministration/tests/Tuleap/Baseline/Domain/RoleAssignmentsUpdateTest.php +62 −0 Go to diff View file