1
0

explicitly mock user+role in *IntTest, set global role HOSTMASTER only in dev profile

This commit is contained in:
Michael Hoennig
2019-04-27 11:10:36 +02:00
parent 5d843f4725
commit b9a7c33c6a
6 changed files with 28 additions and 4 deletions

View File

@ -42,9 +42,6 @@ public class HsadminNgApp {
@PostConstruct
public void initApplication() {
// TODO: remove this hack once proper user roles are implemented
SecurityUtils.addUserRole(null, null, Role.HOSTMASTER);
Collection<String> activeProfiles = Arrays.asList(env.getActiveProfiles());
if (activeProfiles.contains(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT) && activeProfiles.contains(JHipsterConstants.SPRING_PROFILE_PRODUCTION)) {
log.error("You have misconfigured your application! It should not run " +
@ -54,6 +51,14 @@ public class HsadminNgApp {
log.error("You have misconfigured your application! It should not " +
"run with both the 'dev' and 'cloud' profiles at the same time.");
}
// TODO: remove this hack once proper user roles are implemented
if (activeProfiles.contains(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT)) {
// For some strange reasons, HsadminNgApp is created in locally running tests,
// but not on Jenkins, therefore the login user had no rights and many tests
// failed.
SecurityUtils.addUserRole(null, null, Role.HOSTMASTER);
}
}
/**