Spring security Spring安全ACL是否可以应用于域类级别?

Spring security Spring安全ACL是否可以应用于域类级别?,spring-security,acl,Spring Security,Acl,是否可以对域类(而不是域实例)应用ACL权限。我有一个场景,我想为一类用户提供对域对象完全CRUD的全面权限,而第二类用户必须具有特定的ACL条目才能做到这一点 当然可以将ACL条目与基于角色的权限混合使用来实现这一点,但我觉得有一种更优雅的解决方案,Spring ACL可以在实例级别之外的类级别上工作 我正在查看贫乏的和。查看界面对象性。它表示系统中受保护的对象 /** * Obtains the actual identifier. This identifier must not be

是否可以对域类(而不是域实例)应用ACL权限。我有一个场景,我想为一类用户提供对域对象完全CRUD的全面权限,而第二类用户必须具有特定的ACL条目才能做到这一点

当然可以将ACL条目与基于角色的权限混合使用来实现这一点,但我觉得有一种更优雅的解决方案,Spring ACL可以在实例级别之外的类级别上工作


我正在查看贫乏的和。

查看界面
对象性
。它表示系统中受保护的对象

/**
 * Obtains the actual identifier. This identifier must not be reused to represent other domain objects with
 * the same javaType.
 *
 * Because ACLs are largely immutable, it is strongly recommended to use
 * a synthetic identifier (such as a database sequence number for the primary key). Do not use an identifier with
 * business meaning, as that business meaning may change in the future such change will cascade to the ACL
 * subsystem data.
 *
 * @return the identifier (unique within this type; never null)
 */
Serializable getIdentifier();

/**
 * Obtains the "type" metadata for the domain object. This will often be a Java type name (an interface or a class)
 * – traditionally it is the name of the domain object implementation class.
 *
 * @return the "type" of the domain object (never null).
 */
String getType();
正如您所见,Spring安全性使用
Serializable
来描述标识符的类型。 因此,可以使用带有类名的字符串

您需要更新SQL模式,因为Spring Security的作者假设大多数人都会通过长/整数ID标识对象

create table acl_object_identity(
...
object_id_class bigint not null,
object_id_identity bigint not null,
正如我所检查的,
JdbcMutableAclService
能够处理该定制,因为它只使用
ObjectIdentity
接口

研究
org.springframework.security.acls
包的源代码