当前位置: 首页>>代码示例>>Java>>正文


Java MutableAcl.updateAce方法代码示例

本文整理汇总了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);
}
 
开发者ID:cedac-software,项目名称:spring-security-mongodb,代码行数:9,代码来源:MongoMutableAclServiceTests.java

示例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;
}
 
开发者ID:apache,项目名称:kylin,代码行数:38,代码来源:AccessService.java

示例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;
}
 
开发者ID:KylinOLAP,项目名称:Kylin,代码行数:32,代码来源:AccessService.java


注:本文中的org.springframework.security.acls.model.MutableAcl.updateAce方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。