Commit db9e0798 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

Merge branch '563-spring-security' into 563-spring-security-frontend

parents 59b201ae 4ed29a17
......@@ -100,23 +100,7 @@ public class UserService implements IUserService {
Arrays.stream(ConfigurationElementType.values())
.filter(type -> type.getGroup() == ConfigurationElementTypeGroup.DEFAULT_USER_PRIVILEGES)
.filter(type -> Boolean.valueOf(configurationService.getConfigurationValue(type)))
.forEach(type -> {
switch (type) {
case DEFAULT_CAN_CREATE_OVERLAYS:
grantUserPrivilege(user, PrivilegeType.CAN_CREATE_OVERLAYS);
break;
case DEFAULT_READ_PROJECT:
grantUserPrivilege(user, PrivilegeType.READ_PROJECT, "*");
projectDao.getAll()
.forEach(project -> grantUserPrivilege(user, PrivilegeType.READ_PROJECT, project.getProjectId()));
break;
case DEFAULT_WRITE_PROJECT:
grantUserPrivilege(user, PrivilegeType.WRITE_PROJECT, "*");
projectDao.getAll()
.forEach(project -> grantUserPrivilege(user, PrivilegeType.WRITE_PROJECT, project.getProjectId()));
break;
}
});
.forEach(type -> grantPrivilegesForDefaultConfigurationElementType(user, type));
}
@Override
......@@ -181,4 +165,24 @@ public class UserService implements IUserService {
return result;
}
private void grantPrivilegesForDefaultConfigurationElementType(User user, ConfigurationElementType type) {
switch (type) {
case DEFAULT_CAN_CREATE_OVERLAYS:
grantUserPrivilege(user, PrivilegeType.CAN_CREATE_OVERLAYS);
break;
case DEFAULT_READ_PROJECT:
grantUserPrivilege(user, PrivilegeType.READ_PROJECT, "*");
projectDao.getAll()
.forEach(project -> grantUserPrivilege(user, PrivilegeType.READ_PROJECT, project.getProjectId()));
break;
case DEFAULT_WRITE_PROJECT:
grantUserPrivilege(user, PrivilegeType.WRITE_PROJECT, "*");
projectDao.getAll()
.forEach(project -> grantUserPrivilege(user, PrivilegeType.WRITE_PROJECT, project.getProjectId()));
break;
default:
throw new IllegalArgumentException("The configuration element type '+" + type + "' is not handled.");
}
}
}
#Set root logger 's level
appenders = console, file
#Set the behavior of the CONSOLE appender
appender.console.type = Console
appender.console.name = STDOUT
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = %d %5p [%t] (%F:%L) - %m%n
#Set the behavior of the FILE appender
appender.file.type = File
appender.file.name = LogToFile
appender.file.fileName=${sys:catalina.base}/logs/minerva.txt
appender.file.layout.type=PatternLayout
appender.file.layout.pattern= %d %5p [%t] (%F:%L) - %m%n
logger.minerva.name = lcsb
logger.minerva.level = debug
#silence some debug information
logger.minerva-persist.name = lcsb.mapviewer.persist.DbUtils
logger.minerva-persist.level = info
logger.minerva-cache.name = lcsb.mapviewer.annotation.cache
logger.minerva-cache.level = info
#remove spring info messages
logger.springframework.name = org.springframework
logger.springframework.level = warn
#remove hibernate info messages
logger.hibernate.name = org.hibernate
logger.hibernate.level = warn
rootLogger.level = info
rootLogger.appenderRefs = console, file
rootLogger.appenderRef.console.ref = STDOUT
rootLogger.appenderRef.file.ref = LogToFile
#Set root logger 's level
appenders = console, file
#Set the behavior of the CONSOLE appender
appender.console.type = Console
appender.console.name = STDOUT
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = %d %5p [%t] (%F:%L) - %m%n
#Set the behavior of the FILE appender
appender.file.type = File
appender.file.name = LogToFile
appender.file.fileName=${sys:catalina.base}/logs/minerva.txt
appender.file.layout.type=PatternLayout
appender.file.layout.pattern= %d %5p [%t] (%F:%L) - %m%n
logger.minerva.name = lcsb
logger.minerva.level = debug
#silence some debug information
logger.minerva-persist.name = lcsb.mapviewer.persist.DbUtils
logger.minerva-persist.level = info
logger.minerva-cache.name = lcsb.mapviewer.annotation.cache
logger.minerva-cache.level = info
#remove spring info messages
logger.springframework.name = org.springframework
logger.springframework.level = warn
#remove hibernate info messages
logger.hibernate.name = org.hibernate
logger.hibernate.level = warn
rootLogger.level = info
rootLogger.appenderRefs = console, file
rootLogger.appenderRef.console.ref = STDOUT
rootLogger.appenderRef.file.ref = LogToFile
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment