Package org.jtalks.common.security.acl

Examples of org.jtalks.common.security.acl.ExtendedMutableAcl


        Long targetId = 1L;
        String targetType = "BRANCH";
        ObjectIdentityImpl objectIdentity = new ObjectIdentityImpl(targetType, targetId);
        when(aclUtil.createIdentityFor(any(Entity.class))).thenReturn(objectIdentity);
        ExtendedMutableAcl mutableAcl = mock(ExtendedMutableAcl.class);
        List<AccessControlEntry> controlEntries = new ArrayList<>();
        when(mutableAcl.getEntries()).thenReturn(controlEntries);
        when(aclUtil.getAclFor(objectIdentity)).thenReturn(mutableAcl);

        manager = new PermissionManager(aclManager, groupDao, aclUtil, pluginPermissionManager);
    }
View Full Code Here


                new org.springframework.security.acls.domain.AclAuthorizationStrategyImpl(
                        new GrantedAuthorityImpl("some_role")
                );
        ObjectIdentity entityIdentity = new AclUtil(null).createIdentity(entityId,
                entity.getClass().getSimpleName());
        ExtendedMutableAcl mutableAcl = mock(ExtendedMutableAcl.class);
        List<AccessControlEntry> accessControlEntries = new ArrayList<>();

        Acl acl = new AclImpl(entityIdentity, entityId + 1, aclAuthorizationStrategy, auditLogger);

        long lastGroupId = 1;

        for (int i = 0; i < permissions.length; i++) {
            for (int j = 0, count = RandomUtils.nextInt(20) + 10; j < count; j++) {
                Group group = randomGroup(lastGroupId++);
                groups.add(group);

                this.permissions.add(permissions[i]);
                groupAces.add(buildGroupAce(entity, permissions[i], (i % 2 == 1), acl,
                        new UserGroupSid(group.getId())));
            }
            AccessControlEntry controlEntry = mock(AccessControlEntry.class);
            when(controlEntry.getPermission()).thenReturn(permissions[i]);
            when(controlEntry.getSid()).thenReturn(UserSid.createAnonymous());
            when(controlEntry.isGranting()).thenReturn((i % 2 == 1));
            accessControlEntries.add(controlEntry);
        }
        when(mutableAcl.getEntries()).thenReturn(accessControlEntries);
        when(aclUtil.getAclFor(entity)).thenReturn(mutableAcl);
    }
View Full Code Here

TOP

Related Classes of org.jtalks.common.security.acl.ExtendedMutableAcl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.