本文整理汇总了Java中org.springframework.security.acls.model.MutableAcl.updateAce方法的典型用法代码示例。如果您正苦于以下问题:Java MutableAcl.updateAce方法的具体用法?Java MutableAcl.updateAce怎么用?Java MutableAcl.updateAce使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.security.acls.model.MutableAcl
的用法示例。
在下文中一共展示了MutableAcl.updateAce方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateAcl_updateEntries
import org.springframework.security.acls.model.MutableAcl; //导入方法依赖的package包/类
@Test
@ShouldMatchDataSet
public void updateAcl_updateEntries() {
MutableAcl acl = (MutableAcl) fixture.readAclById(new ObjectIdentityImpl("com.cedac.smartresidence.profile.domain.Home", "1"));
acl.updateAce(2, BasePermission.DELETE);
fixture.updateAcl(acl);
}
示例2: hasPermission
import org.springframework.security.acls.model.MutableAcl; //导入方法依赖的package包/类
@Transactional
@PreAuthorize(Constant.ACCESS_HAS_ROLE_ADMIN + " or hasPermission(#ae, 'ADMINISTRATION')")
public Acl update(AclEntity ae, Long accessEntryId, Permission newPermission) {
Message msg = MsgPicker.getMsg();
if (ae == null)
throw new BadRequestException(msg.getACL_DOMAIN_NOT_FOUND());
if (accessEntryId == null)
throw new BadRequestException(msg.getACE_ID_REQUIRED());
if (newPermission == null)
throw new BadRequestException(msg.getACL_PERMISSION_REQUIRED());
ObjectIdentity objectIdentity = new ObjectIdentityImpl(ae.getClass(), ae.getId());
MutableAcl acl = (MutableAcl) aclService.readAclById(objectIdentity);
int indexOfAce = -1;
for (int i = 0; i < acl.getEntries().size(); i++) {
AccessControlEntry ace = acl.getEntries().get(i);
if (ace.getId().equals(accessEntryId)) {
indexOfAce = i;
break;
}
}
if (indexOfAce != -1) {
secureOwner(acl, indexOfAce);
try {
acl.updateAce(indexOfAce, newPermission);
acl = aclService.updateAcl(acl);
} catch (NotFoundException e) {
//do nothing?
}
}
return acl;
}
示例3: hasPermission
import org.springframework.security.acls.model.MutableAcl; //导入方法依赖的package包/类
@Transactional
@PreAuthorize(Constant.ACCESS_HAS_ROLE_ADMIN + " or hasPermission(#ae, 'ADMINISTRATION')")
public Acl update(AclEntity ae, Long accessEntryId, Permission newPermission) {
Assert.notNull(ae, "Acl domain object required");
Assert.notNull(accessEntryId, "Ace id required");
Assert.notNull(newPermission, "Acl permission required");
ObjectIdentity objectIdentity = new ObjectIdentityImpl(ae.getClass(), ae.getId());
MutableAcl acl = (MutableAcl) aclService.readAclById(objectIdentity);
int indexOfAce = -1;
for (int i = 0; i < acl.getEntries().size(); i++) {
AccessControlEntry ace = acl.getEntries().get(i);
if (ace.getId().equals(accessEntryId)) {
indexOfAce = i;
break;
}
}
if (indexOfAce != -1) {
secureOwner(acl, indexOfAce);
try {
acl.updateAce(indexOfAce, newPermission);
acl = aclService.updateAcl(acl);
} catch (NotFoundException e) {
}
}
return acl;
}