TSK-524: removed unnecessary field sqlSessionFactory and refactored code to remove warnings.
This commit is contained in:
parent
85b09508e5
commit
4bac0cb6e3
|
|
@ -58,7 +58,6 @@ public class TaskanaEngineImpl implements TaskanaEngine {
|
||||||
protected TaskanaEngineConfiguration taskanaEngineConfiguration;
|
protected TaskanaEngineConfiguration taskanaEngineConfiguration;
|
||||||
protected TransactionFactory transactionFactory;
|
protected TransactionFactory transactionFactory;
|
||||||
protected SqlSessionManager sessionManager;
|
protected SqlSessionManager sessionManager;
|
||||||
protected SqlSessionFactory sessionFactory;
|
|
||||||
protected ConnectionManagementMode mode = ConnectionManagementMode.PARTICIPATE;
|
protected ConnectionManagementMode mode = ConnectionManagementMode.PARTICIPATE;
|
||||||
protected java.sql.Connection connection = null;
|
protected java.sql.Connection connection = null;
|
||||||
|
|
||||||
|
|
@ -281,9 +280,7 @@ public class TaskanaEngineImpl implements TaskanaEngine {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void checkRoleMembership(TaskanaRole... roles) throws NotAuthorizedException {
|
public void checkRoleMembership(TaskanaRole... roles) throws NotAuthorizedException {
|
||||||
if (isUserInRole(roles)) {
|
if (!isUserInRole(roles)) {
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
if (LOGGER.isErrorEnabled()) {
|
if (LOGGER.isErrorEnabled()) {
|
||||||
String accessIds = LoggerUtils.listToString(CurrentUserContext.getAccessIds());
|
String accessIds = LoggerUtils.listToString(CurrentUserContext.getAccessIds());
|
||||||
String rolesAsString = Arrays.toString(roles);
|
String rolesAsString = Arrays.toString(roles);
|
||||||
|
|
@ -306,19 +303,20 @@ public class TaskanaEngineImpl implements TaskanaEngine {
|
||||||
public boolean isUserInRole(TaskanaRole... roles) {
|
public boolean isUserInRole(TaskanaRole... roles) {
|
||||||
if (!getConfiguration().isSecurityEnabled()) {
|
if (!getConfiguration().isSecurityEnabled()) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
|
||||||
List<String> accessIds = CurrentUserContext.getAccessIds();
|
|
||||||
Set<String> rolesMembers = new HashSet<>();
|
|
||||||
for (TaskanaRole role : roles) {
|
|
||||||
rolesMembers.addAll(getConfiguration().getRoleMap().get(role));
|
|
||||||
}
|
|
||||||
for (String accessId : accessIds) {
|
|
||||||
if (rolesMembers.contains(accessId)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<String> accessIds = CurrentUserContext.getAccessIds();
|
||||||
|
Set<String> rolesMembers = new HashSet<>();
|
||||||
|
for (TaskanaRole role : roles) {
|
||||||
|
rolesMembers.addAll(getConfiguration().getRoleMap().get(role));
|
||||||
|
}
|
||||||
|
for (String accessId : accessIds) {
|
||||||
|
if (rolesMembers.contains(accessId)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue