public void updateAcl( UIRepositoryObjectAcl aclToUpdate ) {
    List<ObjectAce> aces = obj.getAces();
    for ( ObjectAce ace : aces ) {
      if ( ace.getRecipient().getName().equals( aclToUpdate.getRecipientName() ) ) {
        ace.setPermissions( aclToUpdate.getPermissionSet() );
      }
    }
    UIRepositoryObjectAcl acl = getAcl( aclToUpdate.getRecipientName() );
    acl.setPermissionSet( aclToUpdate.getPermissionSet() );
    this.firePropertyChange( "acls", null, getAcls() ); //$NON-NLS-1$

    // above firePropertyChange replaces all elements in the listBox and therefore clears any selected elements;
    // however, the selectedAclList field is never updated because no selectedIndices event is ever called; manually
    // update it to reflect the selected state of the user/role list now (no selection)
    selectedAclList.clear();

    // Setting the selected index
    List<UIRepositoryObjectAcl> aclList = new ArrayList<UIRepositoryObjectAcl>();
    aclList.add( aclToUpdate );
    setSelectedAclList( aclList );

    setModelDirty( true );
  }
@Test
  public void testUpdateAcl() {

    List<UIRepositoryObjectAcl> originalUIAcls = Arrays.asList( new UIRepositoryObjectAcl[] { objectAcl1, objectAcl2 } );
    repositoryObjectAcls.addAcls( originalUIAcls );

    objectAcl2.addPermission( RepositoryFilePermission.DELETE );

    repositoryObjectAcls.updateAcl( objectAcl2 );

    // Assert that the delete permissions is added
    for ( UIRepositoryObjectAcl uiAcl : repositoryObjectAcls.getAcls() ) {
      if ( objectAcl2.getRecipientName().equals( uiAcl.getRecipientName() ) ) {
        assertEquals( "Delete permission was not added", objectAcl2.getPermissionSet(), uiAcl.getPermissionSet() );
      }
    }
  }