mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-06-01 09:42:13 +00:00
Made AclClassIdUtils genuinely package level by injecting the conversionService instead of AclClassIdUtils
Fixes gh-4814
This commit is contained in:
parent
2c362456fd
commit
ccc4e1c876
@ -29,7 +29,7 @@ import org.springframework.security.acls.model.ObjectIdentity;
|
|||||||
* the correct Java type as specified by <code>acl_class.class_id_type</code>.
|
* the correct Java type as specified by <code>acl_class.class_id_type</code>.
|
||||||
* @author paulwheeler
|
* @author paulwheeler
|
||||||
*/
|
*/
|
||||||
public class AclClassIdUtils {
|
class AclClassIdUtils {
|
||||||
private static final String DEFAULT_CLASS_ID_TYPE_COLUMN_NAME = "class_id_type";
|
private static final String DEFAULT_CLASS_ID_TYPE_COLUMN_NAME = "class_id_type";
|
||||||
private static final Log log = LogFactory.getLog(AclClassIdUtils.class);
|
private static final Log log = LogFactory.getLog(AclClassIdUtils.class);
|
||||||
|
|
||||||
@ -38,6 +38,10 @@ public class AclClassIdUtils {
|
|||||||
public AclClassIdUtils() {
|
public AclClassIdUtils() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public AclClassIdUtils(ConversionService conversionService) {
|
||||||
|
this.conversionService = conversionService;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts the raw type from the database into the right Java type. For most applications the 'raw type' will be Long, for some applications
|
* Converts the raw type from the database into the right Java type. For most applications the 'raw type' will be Long, for some applications
|
||||||
* it could be String.
|
* it could be String.
|
||||||
|
@ -31,6 +31,7 @@ import java.util.Set;
|
|||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
|
|
||||||
import org.springframework.core.convert.ConversionException;
|
import org.springframework.core.convert.ConversionException;
|
||||||
|
import org.springframework.core.convert.ConversionService;
|
||||||
import org.springframework.jdbc.core.JdbcTemplate;
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
import org.springframework.jdbc.core.PreparedStatementSetter;
|
import org.springframework.jdbc.core.PreparedStatementSetter;
|
||||||
import org.springframework.jdbc.core.ResultSetExtractor;
|
import org.springframework.jdbc.core.ResultSetExtractor;
|
||||||
@ -553,8 +554,8 @@ public class BasicLookupStrategy implements LookupStrategy {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void setAclClassIdUtils(AclClassIdUtils aclClassIdUtils) {
|
public final void setConversionService(ConversionService conversionService) {
|
||||||
this.aclClassIdUtils = aclClassIdUtils;
|
this.aclClassIdUtils = new AclClassIdUtils(conversionService);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ~ Inner Classes
|
// ~ Inner Classes
|
||||||
|
@ -26,6 +26,7 @@ import javax.sql.DataSource;
|
|||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
import org.springframework.core.convert.ConversionService;
|
||||||
import org.springframework.jdbc.core.JdbcTemplate;
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
import org.springframework.jdbc.core.RowMapper;
|
import org.springframework.jdbc.core.RowMapper;
|
||||||
import org.springframework.security.acls.domain.ObjectIdentityImpl;
|
import org.springframework.security.acls.domain.ObjectIdentityImpl;
|
||||||
@ -163,8 +164,8 @@ public class JdbcAclService implements AclService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAclClassIdUtils(AclClassIdUtils aclClassIdUtils) {
|
public void setConversionService(ConversionService conversionService) {
|
||||||
this.aclClassIdUtils = aclClassIdUtils;
|
this.aclClassIdUtils = new AclClassIdUtils(conversionService);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean isAclClassIdSupported() {
|
protected boolean isAclClassIdSupported() {
|
||||||
|
@ -70,13 +70,11 @@ public class BasicLookupStrategyWithAclClassTypeTests extends AbstractBasicLooku
|
|||||||
@Before
|
@Before
|
||||||
public void initializeBeans() {
|
public void initializeBeans() {
|
||||||
super.initializeBeans();
|
super.initializeBeans();
|
||||||
AclClassIdUtils aclClassIdUtils = new AclClassIdUtils();
|
|
||||||
aclClassIdUtils.setConversionService(new DefaultConversionService());
|
|
||||||
uuidEnabledStrategy = new BasicLookupStrategy(getDataSource(), aclCache(), aclAuthStrategy(),
|
uuidEnabledStrategy = new BasicLookupStrategy(getDataSource(), aclCache(), aclAuthStrategy(),
|
||||||
new DefaultPermissionGrantingStrategy(new ConsoleAuditLogger()));
|
new DefaultPermissionGrantingStrategy(new ConsoleAuditLogger()));
|
||||||
uuidEnabledStrategy.setPermissionFactory(new DefaultPermissionFactory());
|
uuidEnabledStrategy.setPermissionFactory(new DefaultPermissionFactory());
|
||||||
uuidEnabledStrategy.setAclClassIdSupported(true);
|
uuidEnabledStrategy.setAclClassIdSupported(true);
|
||||||
uuidEnabledStrategy.setAclClassIdUtils(aclClassIdUtils);
|
uuidEnabledStrategy.setConversionService(new DefaultConversionService());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
|
@ -5,11 +5,8 @@
|
|||||||
|
|
||||||
<import resource="jdbcMutableAclServiceTests-context.xml"/>
|
<import resource="jdbcMutableAclServiceTests-context.xml"/>
|
||||||
|
|
||||||
<bean id="aclClassIdUtils" class="org.springframework.security.acls.jdbc.AclClassIdUtils">
|
<bean id="conversionService" class="org.springframework.core.convert.support.DefaultConversionService"/>
|
||||||
<property name="conversionService">
|
|
||||||
<bean class="org.springframework.core.convert.support.DefaultConversionService"/>
|
|
||||||
</property>
|
|
||||||
</bean>
|
|
||||||
<!-- Overridden bean definitions -->
|
<!-- Overridden bean definitions -->
|
||||||
|
|
||||||
<bean id="aclService" class="org.springframework.security.acls.jdbc.JdbcMutableAclService">
|
<bean id="aclService" class="org.springframework.security.acls.jdbc.JdbcMutableAclService">
|
||||||
@ -17,7 +14,7 @@
|
|||||||
<constructor-arg ref="lookupStrategy"/>
|
<constructor-arg ref="lookupStrategy"/>
|
||||||
<constructor-arg ref="aclCache"/>
|
<constructor-arg ref="aclCache"/>
|
||||||
<property name="aclClassIdSupported" value="true"/>
|
<property name="aclClassIdSupported" value="true"/>
|
||||||
<property name="aclClassIdUtils" ref="aclClassIdUtils"/>
|
<property name="conversionService" ref="conversionService"/>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="lookupStrategy" class="org.springframework.security.acls.jdbc.BasicLookupStrategy">
|
<bean id="lookupStrategy" class="org.springframework.security.acls.jdbc.BasicLookupStrategy">
|
||||||
@ -28,6 +25,6 @@
|
|||||||
<bean class="org.springframework.security.acls.domain.ConsoleAuditLogger"/>
|
<bean class="org.springframework.security.acls.domain.ConsoleAuditLogger"/>
|
||||||
</constructor-arg>
|
</constructor-arg>
|
||||||
<property name="aclClassIdSupported" value="true"/>
|
<property name="aclClassIdSupported" value="true"/>
|
||||||
<property name="aclClassIdUtils" ref="aclClassIdUtils"/>
|
<property name="conversionService" ref="conversionService"/>
|
||||||
</bean>
|
</bean>
|
||||||
</beans>
|
</beans>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user