insert into acl_user
select 'file', document_id, author_id, -1
from document_author
where version_num = (
select max(version_num)
from document_revision
where document_revision.document_id = document_author.document_id
) and not exists (
select *
from acl_user
where acl_id = 'file'
and object_id = document_id
and user_id = author_id
) and document_id in (select id from getDocumentTree(179)) ;
Ovaj zadnji uvjet ograničava dio stabla