Package org.springframework.security.acls.model

Examples of org.springframework.security.acls.model.ObjectIdentity


                + "INSERT INTO acl_object_identity(ID,OBJECT_ID_CLASS,OBJECT_ID_IDENTITY,PARENT_OBJECT,OWNER_SID,ENTRIES_INHERITING) VALUES (6,2,106,4,1,1);"
                + "INSERT INTO acl_object_identity(ID,OBJECT_ID_CLASS,OBJECT_ID_IDENTITY,PARENT_OBJECT,OWNER_SID,ENTRIES_INHERITING) VALUES (7,2,107,5,1,1);"
                + "INSERT INTO acl_entry(ID,ACL_OBJECT_IDENTITY,ACE_ORDER,SID,MASK,GRANTING,AUDIT_SUCCESS,AUDIT_FAILURE) VALUES (5,4,0,1,1,1,0,0)";
        jdbcTemplate.execute(query);

        ObjectIdentity grandParentOid = new ObjectIdentityImpl(TARGET_CLASS, new Long(104));
        ObjectIdentity parent1Oid = new ObjectIdentityImpl(TARGET_CLASS, new Long(105));
        ObjectIdentity parent2Oid = new ObjectIdentityImpl(TARGET_CLASS, Integer.valueOf(106));
        ObjectIdentity childOid = new ObjectIdentityImpl(TARGET_CLASS, Integer.valueOf(107));

        // First lookup only child, thus populating the cache with grandParent, parent1 and child
        List<Permission> checkPermission = Arrays.asList(BasePermission.READ);
        List<Sid> sids = Arrays.asList(BEN_SID);
        List<ObjectIdentity> childOids = Arrays.asList(childOid);
View Full Code Here


    public void nullOwnerIsNotSupported() {
        String query = "INSERT INTO acl_object_identity(ID,OBJECT_ID_CLASS,OBJECT_ID_IDENTITY,PARENT_OBJECT,OWNER_SID,ENTRIES_INHERITING) VALUES (4,2,104,null,null,1);";

        jdbcTemplate.execute(query);

        ObjectIdentity oid = new ObjectIdentityImpl(TARGET_CLASS, new Long(104));

        strategy.readAclsById(Arrays.asList(oid), Arrays.asList(BEN_SID));
    }
View Full Code Here

    }

    @Test
    public void testEquals() {
        final Acl mockAcl = mock(Acl.class);
        final ObjectIdentity oid = mock(ObjectIdentity.class);

        when(mockAcl.getObjectIdentity()).thenReturn(oid);
        Sid sid = new PrincipalSid("johndoe");

        AccessControlEntry ace = new AccessControlEntryImpl(Long.valueOf(1), mockAcl, sid, BasePermission.ADMINISTRATION,
View Full Code Here

        }
    }

    @Test
    public void gettersReturnExpectedValues() throws Exception {
        ObjectIdentity obj = new ObjectIdentityImpl(DOMAIN_CLASS, Long.valueOf(1));
        assertEquals(Long.valueOf(1), obj.getIdentifier());
        assertEquals(MockIdDomainObject.class.getName(), obj.getType());
    }
View Full Code Here

        new ObjectIdentityImpl("", Long.valueOf(1));
    }

    @Test
    public void testEquals() throws Exception {
        ObjectIdentity obj = new ObjectIdentityImpl(DOMAIN_CLASS, Long.valueOf(1));
        MockIdDomainObject mockObj = new MockIdDomainObject();
        mockObj.setId(Long.valueOf(1));

        String string = "SOME_STRING";
        assertNotSame(obj, string);
        assertFalse(obj.equals(null));
        assertFalse(obj.equals("DIFFERENT_OBJECT_TYPE"));
        assertFalse(obj.equals(new ObjectIdentityImpl(DOMAIN_CLASS, Long.valueOf(2))));
        assertFalse(obj.equals(new ObjectIdentityImpl(
                "org.springframework.security.acls.domain.ObjectIdentityImplTests$MockOtherIdDomainObject",
                Long.valueOf(1))));
        assertEquals(new ObjectIdentityImpl(DOMAIN_CLASS,Long.valueOf(1)), obj);
        assertEquals(obj, new ObjectIdentityImpl(mockObj));
    }
View Full Code Here

        assertEquals(obj, new ObjectIdentityImpl(mockObj));
    }

    @Test
    public void hashcodeIsDifferentForDifferentJavaTypes() throws Exception {
        ObjectIdentity obj = new ObjectIdentityImpl(Object.class, Long.valueOf(1));
        ObjectIdentity obj2 = new ObjectIdentityImpl(String.class, Long.valueOf(1));
        assertFalse(obj.hashCode() == obj2.hashCode());
    }
View Full Code Here

        assertFalse(obj.hashCode() == obj2.hashCode());
    }

    @Test
    public void longAndIntegerIdsWithSameValueAreEqualAndHaveSameHashcode() {
        ObjectIdentity obj = new ObjectIdentityImpl(Object.class, new Long(5));
        ObjectIdentity obj2 = new ObjectIdentityImpl(Object.class, Integer.valueOf(5));

        assertEquals(obj, obj2);
        assertEquals(obj.hashCode(), obj2.hashCode());
    }
View Full Code Here

        assertEquals(obj.hashCode(), obj2.hashCode());
    }

    @Test
    public void equalStringIdsAreEqualAndHaveSameHashcode() throws Exception {
        ObjectIdentity obj = new ObjectIdentityImpl(Object.class, "1000");
        ObjectIdentity obj2 = new ObjectIdentityImpl(Object.class, "1000");
        assertEquals(obj, obj2);
        assertEquals(obj.hashCode(), obj2.hashCode());
    }
View Full Code Here

        assertEquals(obj.hashCode(), obj2.hashCode());
    }

    @Test
    public void stringAndNumericIdsAreNotEqual() throws Exception {
        ObjectIdentity obj = new ObjectIdentityImpl(Object.class, "1000");
        ObjectIdentity obj2 = new ObjectIdentityImpl(Object.class, Long.valueOf(1000));
        assertFalse(obj.equals(obj2));
    }
View Full Code Here

        Assert.notNull(mutableAclService, "mutableAclService required");
    }

    public void addPermission(Contact contact, Sid recipient, Permission permission) {
        MutableAcl acl;
        ObjectIdentity oid = new ObjectIdentityImpl(Contact.class, contact.getId());

        try {
            acl = (MutableAcl) mutableAclService.readAclById(oid);
        } catch (NotFoundException nfe) {
            acl = mutableAclService.createAcl(oid);
View Full Code Here

TOP

Related Classes of org.springframework.security.acls.model.ObjectIdentity

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.