Permissions 为什么hasPermission需要name和primKey?
Liferay的方法需要Permissions 为什么hasPermission需要name和primKey?,permissions,liferay,primary-key,Permissions,Liferay,Primary Key,Liferay的方法需要name和primKey: boolean hasPermission(long groupId, String name, long primKey, String actionId) 以下是这两个参数的文档: name - the resource's name, which can be either a class name or
name
和primKey
:
boolean hasPermission(long groupId,
String name,
long primKey,
String actionId)
以下是这两个参数的文档:
name - the resource's name, which can be either a class name or a portlet ID
primKey - the primary key of the resource
是关于相同的资源吗?如果是,为什么不直接请求
primKey
?除了Pankaj Kathiriya的评论(primKey不是UUID,因此可能有许多对象具有相同的主键-通常只是一个长的。请注意,权限检查是在资源
实体上完成的-它们的主键由名称组成(String
)和primKey(通常long
)
这也可以使用(不确定是否实际完成)要对操作名称进行健全性检查:实现可以检查给定的对象类是否声明了操作,如果没有,则标记实现错误。不同类型的资源可以具有相同的primKey。例如:webcontent可以具有primKey 12345,其他资源(自定义或Liferay)的primKey也可以具有相同的primKey