mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-09-22 21:55:39 +00:00
Merge branch 'permission-vertical' into bug4709_pv
This commit is contained in:
+29
-17
@@ -142,6 +142,7 @@ import com.sap.sailing.server.testsupport.RacingEventServiceImplMock;
|
||||
import com.sap.sse.common.Color;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
import com.sap.sse.common.Timed;
|
||||
import com.sap.sse.common.TypeBasedServiceFinderFactory;
|
||||
import com.sap.sse.common.Util;
|
||||
import com.sap.sse.common.impl.DegreeBearingImpl;
|
||||
import com.sap.sse.common.impl.MillisecondsDurationImpl;
|
||||
@@ -405,7 +406,7 @@ public class MasterDataImportTest {
|
||||
List<String> groupNamesToExport = new ArrayList<String>();
|
||||
groupNamesToExport.add(group.getName());
|
||||
|
||||
RacingEventServiceImplMock destService;
|
||||
RacingEventService destService;
|
||||
DomainFactory domainFactory;
|
||||
DummyMasterDataRessource spyResource = spyResource(new DummyMasterDataRessource(), sourceService);
|
||||
Mockito.doReturn(securityService).when(spyResource).getSecurityService();
|
||||
@@ -420,10 +421,7 @@ public class MasterDataImportTest {
|
||||
// Delete all data above from the database, to allow recreating all of it on target server
|
||||
deleteAllDataFromDatabase();
|
||||
// Import in new service
|
||||
destService = Mockito.spy(
|
||||
new RacingEventServiceImplMock(new DataImportProgressImpl(randomUUID), serviceFinderFactory) {
|
||||
});
|
||||
Mockito.doReturn(securityService).when(destService).getSecurityService();
|
||||
destService = getDestService(randomUUID, serviceFinderFactory);
|
||||
|
||||
domainFactory = destService.getBaseDomainFactory();
|
||||
DB db = destService.getMongoObjectFactory().getDatabase();
|
||||
@@ -748,10 +746,28 @@ public class MasterDataImportTest {
|
||||
}
|
||||
|
||||
private RacingEventService getDestService(UUID randomUUID) {
|
||||
RacingEventServiceImplMock destService = Mockito
|
||||
.spy(new RacingEventServiceImplMock(new DataImportProgressImpl(randomUUID)) {
|
||||
});
|
||||
Mockito.doReturn(securityService).when(destService).getSecurityService();
|
||||
RacingEventServiceImplMock destService = new RacingEventServiceImplMock(
|
||||
new DataImportProgressImpl(randomUUID)) {
|
||||
|
||||
@Override
|
||||
public SecurityService getSecurityService() {
|
||||
return MasterDataImportTest.this.securityService;
|
||||
}
|
||||
|
||||
};
|
||||
return destService;
|
||||
}
|
||||
|
||||
private RacingEventService getDestService(UUID randomUUID, TypeBasedServiceFinderFactory serviceFinderFactory) {
|
||||
RacingEventServiceImplMock destService = new RacingEventServiceImplMock(new DataImportProgressImpl(randomUUID),
|
||||
serviceFinderFactory) {
|
||||
|
||||
@Override
|
||||
public SecurityService getSecurityService() {
|
||||
return MasterDataImportTest.this.securityService;
|
||||
}
|
||||
|
||||
};
|
||||
return destService;
|
||||
}
|
||||
|
||||
@@ -827,7 +843,7 @@ public class MasterDataImportTest {
|
||||
List<String> groupNamesToExport = new ArrayList<String>();
|
||||
groupNamesToExport.add(group.getName());
|
||||
|
||||
RacingEventServiceImplMock destService;
|
||||
RacingEventService destService;
|
||||
DomainFactory domainFactory;
|
||||
DummyMasterDataRessource spyResource = spyResource(new DummyMasterDataRessource(), sourceService);
|
||||
Mockito.doReturn(securityService).when(spyResource).getSecurityService();
|
||||
@@ -842,9 +858,7 @@ public class MasterDataImportTest {
|
||||
// Delete all data above from the database, to allow recreating all of it on target server
|
||||
deleteAllDataFromDatabase();
|
||||
// Import in new service
|
||||
destService = Mockito.spy(new RacingEventServiceImplMock(new DataImportProgressImpl(randomUUID)) {
|
||||
});
|
||||
Mockito.doReturn(securityService).when(destService).getSecurityService();
|
||||
destService = getDestService(randomUUID);
|
||||
domainFactory = destService.getBaseDomainFactory();
|
||||
inputStream = new ByteArrayInputStream(os.toByteArray());
|
||||
|
||||
@@ -1891,7 +1905,7 @@ public class MasterDataImportTest {
|
||||
// Serialize
|
||||
List<String> groupNamesToExport = Collections.singletonList(leaderboardGroup.getName());
|
||||
|
||||
RacingEventServiceImplMock destService;
|
||||
RacingEventService destService;
|
||||
DomainFactory domainFactory;
|
||||
DummyMasterDataRessource spyResource = spyResource(new DummyMasterDataRessource(), sourceService);
|
||||
Mockito.doReturn(securityService).when(spyResource).getSecurityService();
|
||||
@@ -1906,9 +1920,7 @@ public class MasterDataImportTest {
|
||||
// Delete all data above from the database, to allow recreating all of it on target server
|
||||
deleteAllDataFromDatabase();
|
||||
// Import in new service
|
||||
destService = Mockito.spy(new RacingEventServiceImplMock(new DataImportProgressImpl(randomUUID)) {
|
||||
});
|
||||
Mockito.doReturn(securityService).when(destService).getSecurityService();
|
||||
destService = getDestService(randomUUID);
|
||||
domainFactory = destService.getBaseDomainFactory();
|
||||
inputStream = new ByteArrayInputStream(os.toByteArray());
|
||||
|
||||
|
||||
@@ -1147,11 +1147,16 @@ public class SecurityServiceImpl implements ReplicableSecurityService, ClearStat
|
||||
if (subject == null || !subject.isAuthenticated()) {
|
||||
result = null;
|
||||
} else {
|
||||
String username = subject.getPrincipal().toString();
|
||||
if (username == null || username.length() <= 0) {
|
||||
Object principal = subject.getPrincipal();
|
||||
if (principal == null) {
|
||||
result = null;
|
||||
} else {
|
||||
result = userStore.getUserByName(username);
|
||||
String username = principal.toString();
|
||||
if (username == null || username.length() <= 0) {
|
||||
result = null;
|
||||
} else {
|
||||
result = userStore.getUserByName(username);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user