mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-14 17:26:22 +01:00
Merged in bugfix/migrate_security_xml (pull request #286)
Bugfix/migrate security xml
This commit is contained in:
@@ -81,6 +81,32 @@ class XmlSecurityV1UpdateStepTest {
|
||||
.collect(toList());
|
||||
assertThat(assignedPermission).contains("admins", "vogons");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Nested
|
||||
class WithExistingSecurityXml {
|
||||
|
||||
@BeforeEach
|
||||
void createSecurityV1XML(@TempDirectory.TempDir Path tempDir) throws IOException {
|
||||
Path configDir = tempDir.resolve("config");
|
||||
Files.createDirectories(configDir);
|
||||
copyTestDatabaseFile(configDir, "securityV1.xml");
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldMapV1PermissionsFromSecurityV1XML() throws JAXBException {
|
||||
updateStep.doUpdate();
|
||||
List<String> assignedPermission =
|
||||
assignedPermissionStore.getAll().values()
|
||||
.stream()
|
||||
.filter(a -> a.getPermission().getValue().contains("repository:"))
|
||||
.map(AssignedPermission::getName)
|
||||
.collect(toList());
|
||||
assertThat(assignedPermission).contains("scmadmin");
|
||||
assertThat(assignedPermission).contains("test");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void copyTestDatabaseFile(Path configDir, String fileName) throws IOException {
|
||||
|
||||
Reference in New Issue
Block a user