fixed bug in document permission resolution