问题描述
我使用 spring-security-acl 进行授权。
我想注册一个新用户并授予该用户仅修改其自身的权限。 我正在执行以下步骤:
-
公共无效权限(用户用户){ ObjectIdentity oi = new ObjectIdentityImpl(User.class,user.getId()); sid sid = new PrincipalSid(user.getUserName()); 权限 p = BasePermission.ADMINISTRATION;
// Create or update the relevant ACL MutableAcl acl = null; try { acl = (MutableAcl) mutableAclService.readAclById(oi); } catch (NotFoundException nfe) { // The poblem is on this line,when it calls createAcl SecurityContextHolder.getContext().getAuthentication() gets the anonymousUser as a principal acl = mutableAclService.createAcl(oi); } // Now grant some permissions via an access control entry (ACE) acl.insertAce(acl.getEntries().size(),p,sid,true); mutableAclService.updateAcl(acl); }
但是当我检查 acl_object_identity
表时,对象的 owner_sid
始终是 anonymousUser
。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)