#!perl
use Cassandane::Tiny;

sub test_lookup_only_own_racl
    :UnixHierarchySep :AltNamespace :ReverseACLs
{
    my ($self) = @_;

    $self->{instance}->create_user("other");

    my $admintalk = $self->{adminstore}->get_client();
    $admintalk->create('user/cassandane/foo');
    $self->assert_str_equals('ok',
        $admintalk->get_last_completion_response());
    $admintalk->setacl('user/cassandane/foo',
        'cassandane' => 'l');
    $self->assert_str_equals('ok',
        $admintalk->get_last_completion_response());

    my $imaptalk = $self->{store}->get_client();

    my $data = $imaptalk->list("", "*");
    $self->assert_mailbox_structure($data, '/', {
        'INBOX' => [qw( \\HasNoChildren )],
        'foo' => [qw( \\HasNoChildren )],
    });

    # only "l" permission, should be able to list, but not select!
    $imaptalk->select('foo');
    $self->assert_str_equals('no',
        $imaptalk->get_last_completion_response());
}
