我如何在Spring Security ACL中检查我的对象权限而不是使用hasPermission批注 [英] How do i check my object permissions in spring security acl instead of using hasPermission annotation
本文介绍了我如何在Spring Security ACL中检查我的对象权限而不是使用hasPermission批注的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有一种方法可以直接从我的代码中检查我的类对象权限,而不必使用注释模型,
Is there a way to check my class object permissions directly from my code instead of having the annotation model,
@PostAuthorize("hasPermission(returnObject, 'WRITE')")
public BaseData getSingle(Long id);
推荐答案
Assuming you're intending to use the ACL module, the expression is implemented in AclPermissionEvaluator
. So you can wire up an instance of that with an AclService
, inject it into the classes that need it and call the hasPermission
method directly.
这篇关于我如何在Spring Security ACL中检查我的对象权限而不是使用hasPermission批注的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文