1
votes

Is there any Method which could determine if user has access to document, meaning, user (or user group) exists in any of the Readers or Authors fields?

Example:

  1. we have User1
  2. we have NotesDocument in DB with docUNID, which has Readers/Authors fields, but User1 (and any of his groups) are not present in these fields.

User1 performs var doc = database.getDocumentByUNID(docUNID). Method getDocumentByUNID returns valid doc, but any Method like doc.getItemValueString() – returns empty values.

I see only manual method of deciding if user has access to document - take value of some standard field, like “form”, and if the value isEmpty() == true – user does not have access to the document.

doc.getItemValueString(“form”).isEmpty() == true – user has no access to document.

1
Does this answer work with readers fields too? Try it out. stackoverflow.com/a/21854399/785061Per Henrik Lausten
Use doc.getUniversalID(). It should be empty if the user has no access to the document.Sven Hasselbach
Per, yes, I saw that topic (BTW: also really useful method), but under Anonymous there are some issues with rights, I think...AndrewG10i
Sven, thanks, yes, agree, checking doc.getUniversalID() for emptiness is more universal.AndrewG10i
@SvenHasselbach - move that to an answer, so you get the recognition of Andrews acceptancestwissel

1 Answers

3
votes

Use doc.getUniversalID(). It should be empty if the user has no access to the document.