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>.
|
||||
* @author paulwheeler
|
||||
*/
|
||||
public class AclClassIdUtils {
|
||||
class AclClassIdUtils {
|
||||
private static final String DEFAULT_CLASS_ID_TYPE_COLUMN_NAME = "class_id_type";
|
||||
private static final Log log = LogFactory.getLog(AclClassIdUtils.class);
|
||||
|
||||
|
@ -38,6 +38,10 @@ public class 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
|
||||
* it could be String.
|
||||
|
|
|
@ -31,6 +31,7 @@ import java.util.Set;
|
|||
import javax.sql.DataSource;
|
||||
|
||||
import org.springframework.core.convert.ConversionException;
|
||||
import org.springframework.core.convert.ConversionService;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.jdbc.core.PreparedStatementSetter;
|
||||
import org.springframework.jdbc.core.ResultSetExtractor;
|
||||
|
@ -553,8 +554,8 @@ public class BasicLookupStrategy implements LookupStrategy {
|
|||
}
|
||||
}
|
||||
|
||||
public final void setAclClassIdUtils(AclClassIdUtils aclClassIdUtils) {
|
||||
this.aclClassIdUtils = aclClassIdUtils;
|
||||
public final void setConversionService(ConversionService conversionService) {
|
||||
this.aclClassIdUtils = new AclClassIdUtils(conversionService);
|
||||
}
|
||||
|
||||
// ~ Inner Classes
|
||||
|
|
|
@ -26,6 +26,7 @@ import javax.sql.DataSource;
|
|||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.core.convert.ConversionService;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.jdbc.core.RowMapper;
|
||||
import org.springframework.security.acls.domain.ObjectIdentityImpl;
|
||||
|
@ -163,8 +164,8 @@ public class JdbcAclService implements AclService {
|
|||
}
|
||||
}
|
||||
|
||||
public void setAclClassIdUtils(AclClassIdUtils aclClassIdUtils) {
|
||||
this.aclClassIdUtils = aclClassIdUtils;
|
||||
public void setConversionService(ConversionService conversionService) {
|
||||
this.aclClassIdUtils = new AclClassIdUtils(conversionService);
|
||||
}
|
||||
|
||||
protected boolean isAclClassIdSupported() {
|
||||
|
|
|
@ -70,13 +70,11 @@ public class BasicLookupStrategyWithAclClassTypeTests extends AbstractBasicLooku
|
|||
@Before
|
||||
public void initializeBeans() {
|
||||
super.initializeBeans();
|
||||
AclClassIdUtils aclClassIdUtils = new AclClassIdUtils();
|
||||
aclClassIdUtils.setConversionService(new DefaultConversionService());
|
||||
uuidEnabledStrategy = new BasicLookupStrategy(getDataSource(), aclCache(), aclAuthStrategy(),
|
||||
new DefaultPermissionGrantingStrategy(new ConsoleAuditLogger()));
|
||||
uuidEnabledStrategy.setPermissionFactory(new DefaultPermissionFactory());
|
||||
uuidEnabledStrategy.setAclClassIdSupported(true);
|
||||
uuidEnabledStrategy.setAclClassIdUtils(aclClassIdUtils);
|
||||
uuidEnabledStrategy.setConversionService(new DefaultConversionService());
|
||||
}
|
||||
|
||||
@Before
|
||||
|
|
|
@ -5,11 +5,8 @@
|
|||
|
||||
<import resource="jdbcMutableAclServiceTests-context.xml"/>
|
||||
|
||||
<bean id="aclClassIdUtils" class="org.springframework.security.acls.jdbc.AclClassIdUtils">
|
||||
<property name="conversionService">
|
||||
<bean class="org.springframework.core.convert.support.DefaultConversionService"/>
|
||||
</property>
|
||||
</bean>
|
||||
<bean id="conversionService" class="org.springframework.core.convert.support.DefaultConversionService"/>
|
||||
|
||||
<!-- Overridden bean definitions -->
|
||||
|
||||
<bean id="aclService" class="org.springframework.security.acls.jdbc.JdbcMutableAclService">
|
||||
|
@ -17,7 +14,7 @@
|
|||
<constructor-arg ref="lookupStrategy"/>
|
||||
<constructor-arg ref="aclCache"/>
|
||||
<property name="aclClassIdSupported" value="true"/>
|
||||
<property name="aclClassIdUtils" ref="aclClassIdUtils"/>
|
||||
<property name="conversionService" ref="conversionService"/>
|
||||
</bean>
|
||||
|
||||
<bean id="lookupStrategy" class="org.springframework.security.acls.jdbc.BasicLookupStrategy">
|
||||
|
@ -28,6 +25,6 @@
|
|||
<bean class="org.springframework.security.acls.domain.ConsoleAuditLogger"/>
|
||||
</constructor-arg>
|
||||
<property name="aclClassIdSupported" value="true"/>
|
||||
<property name="aclClassIdUtils" ref="aclClassIdUtils"/>
|
||||
<property name="conversionService" ref="conversionService"/>
|
||||
</bean>
|
||||
</beans>
|
||||
|
|
Loading…
Reference in New Issue