Package org.springframework.security.acls.model

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


        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


    public void delete(Contact contact) {
        contactDao.delete(contact.getId());

        // Delete the ACL information as well
        ObjectIdentity oid = new ObjectIdentityImpl(Contact.class, contact.getId());
        mutableAclService.deleteAcl(oid, false);

        if (logger.isDebugEnabled()) {
            logger.debug("Deleted contact " + contact + " including ACL permissions");
        }
View Full Code Here

            logger.debug("Deleted contact " + contact + " including ACL permissions");
        }
    }

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

        // Remove all permissions associated with this particular recipient (string equality to KISS)
        List<AccessControlEntry> entries = acl.getEntries();
View Full Code Here

            return Tag.SKIP_BODY;
        }

        List<Sid> sids = sidRetrievalStrategy.getSids(SecurityContextHolder.getContext().getAuthentication());
        ObjectIdentity oid = objectIdentityRetrievalStrategy.getObjectIdentity(resolvedDomainObject);

        // Obtain aclEntrys applying to the current Authentication object
        try {
            Acl acl = aclService.readAclById(oid, sids);
View Full Code Here

                + "@" + person[1].toLowerCase() + ".com');");
        }

        // Create acl_object_identity rows (and also acl_class rows as needed
        for (int i = 1; i < createEntities; i++) {
            final ObjectIdentity objectIdentity = new ObjectIdentityImpl(Contact.class, new Long(i));
            tt.execute(new TransactionCallback<Object>() {
                    public Object doInTransaction(TransactionStatus arg0) {
                        mutableAclService.createAcl(objectIdentity);

                        return null;
View Full Code Here

    public boolean hasPermission(Authentication authentication, Serializable targetId,
                                 String targetType, Object permission) {
        boolean result = false;
        Long id = parseTargetId(targetId);

        ObjectIdentity objectIdentity = aclUtil.createIdentity(id, targetType);
        Permission jtalksPermission;
        if (permission instanceof Permission) {
            jtalksPermission = (Permission) permission;
        } else {
            jtalksPermission = getPermission(permission);
View Full Code Here

                        storedUser.getId());
                return !isCheckAllowedGrant;
            }
            List<Group> groups = actualUser.getGroups();
            for (Group group : groups) {
                ObjectIdentity groupIdentity = aclUtil.createIdentity(group.getId(), "GROUP");
                Sid groupSid = sidFactory.create(group);
                List<AccessControlEntry> groupAces;
                try {
                    groupAces = ExtendedMutableAcl.castAndCreate(
                            mutableAclService.readAclById(groupIdentity)).getEntries();
View Full Code Here

        setEnvForPermissionOnGroupTests(false);
        Assert.assertFalse(evaluator.hasPermission(authentication, targetId, targetType, permission));
    }

    private void setEnvForPermissionOnGroupTests(boolean isGranted) {
        ObjectIdentity groupIdentity = new ObjectIdentityImpl("GROUP", targetId);
        Mockito.when(aclUtil.createIdentity(targetId, "GROUP")).thenReturn(groupIdentity);

        List<AccessControlEntry> aces = new ArrayList<>();
        aces.add(createAccessControlEntry(generalPermission, isGranted, groupSid));
        Mockito.when(acl.getEntries()).thenReturn(aces);
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.