Package org.springframework.security.acls.domain

Examples of org.springframework.security.acls.domain.ObjectIdentityImpl


        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

     * Displays the permission admin page for a particular contact.
     */
    @RequestMapping(value="/secure/adminPermission.htm", method=RequestMethod.GET)
    public ModelAndView displayAdminPage(@RequestParam("contactId") int contactId) {
        Contact contact = contactManager.getById(Long.valueOf(contactId));
        Acl acl = aclService.readAclById(new ObjectIdentityImpl(contact));

        Map<String, Object> model = new HashMap<String, Object>();
        model.put("contact", contact);
        model.put("acl", acl);

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

        SecurityContextHolder.clearContext();
    }

    private void changeOwner(int contactNumber, String newOwnerUsername) {
        AclImpl acl = (AclImpl) mutableAclService.readAclById(new ObjectIdentityImpl(Contact.class,
                    new Long(contactNumber)));
        acl.setOwner(new PrincipalSid(newOwnerUsername));
        updateAclInTransaction(acl);
    }
View Full Code Here

    public int getCreateEntities() {
        return createEntities;
    }

    private void grantPermissions(int contactNumber, String recipientUsername, Permission permission) {
        AclImpl acl = (AclImpl) mutableAclService.readAclById(new ObjectIdentityImpl(Contact.class,
                    new Long(contactNumber)));
        acl.insertAce(acl.getEntries().size(), permission, new PrincipalSid(recipientUsername), true);
        updateAclInTransaction(acl);
    }
View Full Code Here

    @BeforeMethod
    public void init() throws NotFoundException {
        MockitoAnnotations.initMocks(this);
        evaluator = new AclGroupPermissionEvaluator(aclManager, aclUtil, groupDao,
                sidFactory, mutableAclService, userDao, pluginManager);
        objectIdentity = new ObjectIdentityImpl(targetType, targetId);
        Mockito.when(aclUtil.createIdentity(targetId, targetType)).thenReturn(objectIdentity);
        user = new JCUser("username", "email", "password");
        user.setId(1);
        userSid = new UserSid(user);
        groupSid = new UserGroupSid(targetId);
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.domain.ObjectIdentityImpl

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.