Determing user access to a document

Is there any way to determine the current user’s access to a specific document? I’m using Readers and Authors fields, which may contain groups or roles, and I can’t figure out any way to decipher what a user’s access to a document is via formula or LotusScript. @UserAccess only gives you the database-level access and is not document specific. I haven’t found anything that deals with document-level security.

The bigger picture is I created a view with totals and then discovered that the totals include documents the current person cannot read. Ultimately I would like to find a workaround for this problem.

Thanks,

Charles

Subject: RE: determing user access to a document

The totals are computed by the server at the time it indexes the view, so they are created without reference to who might have access to particular documents. There’s one set of view totals – not one set for each different user who opens the view. And I assure you that you would not like to wait for the totals to be recalculated each time you opened the view, in a database of any size.

Likewise, the column values are calculated by the server without reference to who is trying to use the view, and stored for all users to have access to. That’s why functions that depend on the identity of the current user – e.g. @UserRoles – do not work in view column or selection formula.

You can create personalized views by making them “desktop private on first use”, so that each user will have a copy of the view stored locally on their computer. In that case, the totals will reflect only those documents to which the current user has access, and you can use use @UserRoles, @UserNamesList, etc. Drawbacks: this takes up space on the user’s disk, and can also be slow because the index is not shared with other users – every time I open my private view, my Notes client has to check every change made since the last time I used the view and update my index accordingly.

Subject: RE: determing user access to a document

Thanks Andre. Regardless of the view totals issue, do you know of any way to determine the current user’s access to a document? There are instances where I want one set of fields visible for Readers and another for Authors. I have not found a way to do that yet when those fields are a combination of roles, canonical names and groups.

Thanks,

Charles

Subject: RE: determing user access to a document

The @Author field is a quick way to return the contents of all the author fields (but it sometimes returns other things, so read the documentation and decide whether you’d rather call out the field names yourself, e.g. (Field1:Field2).

@UserNamesList will tell you all the roles and groups of the current user, plus the wildcard names that could be used to set them access. However, it will only tell you about groups that are in the current database’s ACL list – not all groups of which they are a member. It doesn’t include the user’s [cn] or abbreviated names, but of course you would never use those in an Authors field anyway.

The *= operator will compare two lists and return True if they have any element in common. @IsNotMember could also be used for this.

Then you have to keep in mind that if @UserAccess is > 3, they also have access to edit the document. So your formula for the CFD number field IsEditor would be something like:

@If(@UserAccess > 3; @True; @UserNamesList *= (field1 : field2))

Then you could use that field in your hide formulas, hiding things if !IsEditor.

For best performance, of course you don’t want to evaluate this formula more than once, hence the CFD field.

Also keep in mind that hide formulas aren’t a security measure. It’s very easy to see the values of hidden fields.

Subject: RE: determing user access to a document

Thanks Andre, I’ll give that a try. @CanEdit(@UserName) sure would be a lot easier. :slight_smile: