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


Java CumulativePermission类代码示例

本文整理汇总了Java中org.springframework.security.acls.domain.CumulativePermission的典型用法代码示例。如果您正苦于以下问题:Java CumulativePermission类的具体用法?Java CumulativePermission怎么用?Java CumulativePermission使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CumulativePermission类属于org.springframework.security.acls.domain包,在下文中一共展示了CumulativePermission类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: parsePerms

import org.springframework.security.acls.domain.CumulativePermission; //导入依赖的package包/类
private static Permission parsePerms(String perms) {

        final int length = perms.length();
        if(length > 32) {
            throw new IllegalArgumentException("Too long permission expression: " + perms + " it must be shortest than 32 chars.");
        }
        Permission perm;
        if(length == 1) {
            perm = parseLetter(perms.charAt(0));
        } else {
            CumulativePermission cp = new CumulativePermission();
            for(int i = 0; i < length; ++i) {
                cp.set(parseLetter(perms.charAt(i)));
            }
            perm = cp;
        }
        return perm;
    }
 
开发者ID:codeabovelab,项目名称:haven-platform,代码行数:19,代码来源:PropertyAclServiceConfigurer.java

示例2: cumulativePermissions

import org.springframework.security.acls.domain.CumulativePermission; //导入依赖的package包/类
@Test
 public void cumulativePermissions() {
    Authentication auth = new TestingAuthenticationToken("ben", "ignored", "ROLE_ADMINISTRATOR");
    auth.setAuthenticated(true);
    SecurityContextHolder.getContext().setAuthentication(auth);

    ObjectIdentity topParentOid = new ObjectIdentityImpl(TARGET_CLASS, "110");
    MutableAcl topParent = mongodbMutableAclService.createAcl(topParentOid);

    // Add an ACE permission entry
    Permission cm = new CumulativePermission().set(BasePermission.READ).set(BasePermission.ADMINISTRATION);
    assertEquals(17, cm.getMask());
    Sid benSid = new PrincipalSid(auth);
    topParent.insertAce(0, cm, benSid, true);
    assertEquals(1, topParent.getEntries().size());

    // Explicitly save the changed ACL
    topParent = mongodbMutableAclService.updateAcl(topParent);

    // Check the mask was retrieved correctly
    assertEquals(17, topParent.getEntries().get(0).getPermission().getMask());
    assertTrue(topParent.isGranted(Arrays.asList(cm), Arrays.asList(benSid), true));

    SecurityContextHolder.clearContext();
}
 
开发者ID:AlexCzar,项目名称:spring-security-acl-mongodb,代码行数:26,代码来源:MongodbMutableAclServiceTest.java

示例3: buildFromMask

import org.springframework.security.acls.domain.CumulativePermission; //导入依赖的package包/类
public static Permission buildFromMask(int mask) {
    if (permissionsByInteger.containsKey(mask)) {
        return permissionsByInteger.get(mask);
    }

    // to get this far, we have to use a CumulativePermission
    CumulativePermission cumulativePermission = new CumulativePermission();
    for (int i = 0; i < 32; i++) {
        int permissionToCheck = 1 << i;
        if ((mask & permissionToCheck) == permissionToCheck) {
            Permission permission = permissionsByInteger.get(permissionToCheck);
            if (permission == null) {
            	System.out.println("Mask " + permissionToCheck + " does not have a corresponding static NextServerPermission");
            	continue;
            }
            cumulativePermission.set(permission);
        }
    }

    return cumulativePermission;
}
 
开发者ID:nextreports,项目名称:nextreports-server,代码行数:22,代码来源:NextServerPermission.java


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